Package com.google.gwt.codegen.server
Class StringGenerator
java.lang.Object
com.google.gwt.codegen.server.StringGenerator
- Direct Known Subclasses:
PlainStringGenerator,SafeHtmlStringGenerator
Helper class to produce string expressions consisting of literals and
computed values.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enumType of expression being processed. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final StringBuilderOutput string buffer.protected booleanTrue if we are in the middle of a string literal. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInitialize the StringGenerator with an output buffer. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidvoidappendExpression(String expression, boolean isSafeHtmlTyped, boolean isPrimitiveTyped, boolean needsConversionToString) Append an expression to this string expression.voidAppend part of a string literal.voidappendStringValuedExpression(String expression) Append an expression to this string expression.protected abstract voidvoidComplete the string, closing an open quote and handling empty strings.static StringGeneratorcreate(StringBuilder buf, boolean returnsSafeHtml) Create aStringGeneratorinstance.protected abstract voidprotected abstract voidprotected abstract void
-
Field Details
-
buf
Output string buffer. -
inString
protected boolean inStringTrue if we are in the middle of a string literal.
-
-
Constructor Details
-
StringGenerator
Initialize the StringGenerator with an output buffer.- Parameters:
buf- output buffer
-
-
Method Details
-
create
Create aStringGeneratorinstance.- Parameters:
buf-returnsSafeHtml-- Returns:
StringGeneratorinstance
-
appendExpression
public void appendExpression(String expression, boolean isSafeHtmlTyped, boolean isPrimitiveTyped, boolean needsConversionToString) Append an expression to this string expression.- Parameters:
expression- to addisSafeHtmlTyped- true if the expression is known to be of typeSafeHtml; only relevant if this generator has been initialized to generate aSafeHtml-valued expressionisPrimitiveTyped- true if the expression is of a primitive type; only relevant if this generator has been initialized to generate aSafeHtml-valued expressionneedsConversionToString- true if the expression is not known to be of type String and needs to be converted
-
appendStringLiteral
Append part of a string literal.- Parameters:
str- part of string literal
-
appendStringValuedExpression
Append an expression to this string expression.- Parameters:
expression- to add, which the caller asserts is String-valued
-
completeString
public void completeString()Complete the string, closing an open quote and handling empty strings. -
afterExpression
-
beforeExpression
-
finishOutput
protected abstract void finishOutput() -
forceStringPrefix
protected abstract void forceStringPrefix() -
forceStringSuffix
protected abstract void forceStringSuffix()
-