Package com.google.gwt.codegen.server
Class StringGenerator
- java.lang.Object
-
- com.google.gwt.codegen.server.StringGenerator
-
- Direct Known Subclasses:
PlainStringGenerator,SafeHtmlStringGenerator
public abstract class StringGenerator extends java.lang.ObjectHelper class to produce string expressions consisting of literals and computed values.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classStringGenerator.TypeType of expression being processed.
-
Constructor Summary
Constructors Modifier Constructor Description protectedStringGenerator(java.lang.StringBuilder buf)Initialize the StringGenerator with an output buffer.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidafterExpression(StringGenerator.Type type)voidappendExpression(java.lang.String expression, boolean isSafeHtmlTyped, boolean isPrimitiveTyped, boolean needsConversionToString)Append an expression to this string expression.voidappendStringLiteral(java.lang.String str)Append part of a string literal.voidappendStringValuedExpression(java.lang.String expression)Append an expression to this string expression.protected abstract voidbeforeExpression(StringGenerator.Type type)voidcompleteString()Complete the string, closing an open quote and handling empty strings.static StringGeneratorcreate(java.lang.StringBuilder buf, boolean returnsSafeHtml)Create aStringGeneratorinstance.protected abstract voidfinishOutput()protected abstract voidforceStringPrefix()protected abstract voidforceStringSuffix()
-
-
-
Method Detail
-
create
public static StringGenerator create(java.lang.StringBuilder buf, boolean returnsSafeHtml)
Create aStringGeneratorinstance.- Parameters:
buf-returnsSafeHtml-- Returns:
StringGeneratorinstance
-
appendExpression
public void appendExpression(java.lang.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
public void appendStringLiteral(java.lang.String str)
Append part of a string literal.- Parameters:
str- part of string literal
-
appendStringValuedExpression
public void appendStringValuedExpression(java.lang.String expression)
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
protected abstract void afterExpression(StringGenerator.Type type)
-
beforeExpression
protected abstract void beforeExpression(StringGenerator.Type type)
-
finishOutput
protected abstract void finishOutput()
-
forceStringPrefix
protected abstract void forceStringPrefix()
-
forceStringSuffix
protected abstract void forceStringSuffix()
-
-