|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.antlr.stringtemplate.language.Expr
org.antlr.stringtemplate.language.ASTExpr
A single string template expression enclosed in $...; separator=...$ parsed into an AST chunk to be evaluated.
Field Summary | |
static java.lang.String |
DEFAULT_ATTRIBUTE_NAME
|
static java.lang.String |
DEFAULT_ATTRIBUTE_NAME_DEPRECATED
|
static java.lang.String |
DEFAULT_INDEX_VARIABLE_NAME
|
static java.lang.String |
DEFAULT_MAP_VALUE_NAME
|
static java.lang.String |
REFLECTION_ATTRIBUTES
When lint mode is on, this attribute contains a list of reflection objects that tell you about the attributes set by the user of the template. |
Fields inherited from class org.antlr.stringtemplate.language.Expr |
enclosingTemplate, indentation |
Constructor Summary | |
ASTExpr(StringTemplate enclosingTemplate,
antlr.collections.AST exprTree,
java.util.Map options)
|
Method Summary | |
java.lang.Object |
add(java.lang.Object a,
java.lang.Object b)
For now, we can only add two objects as strings; convert objects to Strings then cat. |
java.lang.Object |
applyListOfAlternatingTemplates(StringTemplate self,
java.lang.Object attributeValue,
java.util.List templatesToApply)
|
java.lang.Object |
applyTemplateToListOfAttributes(StringTemplate self,
java.util.List attributes,
StringTemplate templateToApply)
For |
protected java.lang.String |
computeSeparator(StringTemplate self,
StringTemplateWriter out,
java.lang.Object separator)
A separator is normally just a string literal, but is still an AST that we must evaluate. |
static java.lang.Object |
convertArrayToList(java.lang.Object value)
Do a standard conversion of array attributes to Lists. |
protected void |
evaluateArguments(StringTemplate self)
Evaluate an argument list within the context of the enclosing template but store the values in the context of self, the new embedded template. |
java.lang.Object |
first(java.lang.Object attribute)
Return the first attribute if multiple valued or the attribute itself if single-valued. |
antlr.collections.AST |
getAST()
Return the tree interpreted when this template is written out. |
java.lang.Object |
getObjectProperty(StringTemplate self,
java.lang.Object o,
java.lang.String propertyName)
Return o.getPropertyName() given o and propertyName. |
StringTemplate |
getTemplateInclude(StringTemplate enclosing,
java.lang.String templateName,
StringTemplateAST argumentsAST)
Call a string template with args and return result. |
static boolean |
isValidMapInstance(java.lang.Class type)
|
static boolean |
isValidReturnTypeMapInstance(java.lang.Class type)
A property can be declared as Map, but the instance must be isValidMapInstance(). |
java.lang.Object |
last(java.lang.Object attribute)
Return the last attribute if multiple valued or the attribute itself if single-valued. |
java.lang.Object |
rest(java.lang.Object attribute)
Return the everything but the first attribute if multiple valued or null if single-valued. |
protected void |
setSoleFormalArgumentToIthValue(StringTemplate embedded,
java.util.Map argumentContext,
java.lang.Object ithValue)
|
boolean |
testAttributeTrue(java.lang.Object a)
Normally StringTemplate tests presence or absence of attributes for adherence to my principles of separation, but some people disagree and want to change. |
protected int |
write(StringTemplate self,
java.lang.Object o,
StringTemplateWriter out,
java.lang.Object separator)
|
int |
write(StringTemplate self,
StringTemplateWriter out)
To write out the value of an ASTExpr, invoke the evaluator in eval.g to walk the tree writing out the values. |
int |
writeAttribute(StringTemplate self,
java.lang.Object o,
StringTemplateWriter out)
How to spit out an object. |
Methods inherited from class org.antlr.stringtemplate.language.Expr |
getEnclosingTemplate, getIndentation, setIndentation |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String DEFAULT_ATTRIBUTE_NAME
public static final java.lang.String DEFAULT_ATTRIBUTE_NAME_DEPRECATED
public static final java.lang.String DEFAULT_INDEX_VARIABLE_NAME
public static final java.lang.String DEFAULT_MAP_VALUE_NAME
public static final java.lang.String REFLECTION_ATTRIBUTES
Constructor Detail |
public ASTExpr(StringTemplate enclosingTemplate, antlr.collections.AST exprTree, java.util.Map options)
Method Detail |
public antlr.collections.AST getAST()
public int write(StringTemplate self, StringTemplateWriter out) throws java.io.IOException
write
in class Expr
java.io.IOException
public java.lang.Object applyTemplateToListOfAttributes(StringTemplate self, java.util.List attributes, StringTemplate templateToApply)
public java.lang.Object applyListOfAlternatingTemplates(StringTemplate self, java.lang.Object attributeValue, java.util.List templatesToApply)
protected void setSoleFormalArgumentToIthValue(StringTemplate embedded, java.util.Map argumentContext, java.lang.Object ithValue)
public java.lang.Object getObjectProperty(StringTemplate self, java.lang.Object o, java.lang.String propertyName)
public boolean testAttributeTrue(java.lang.Object a)
public java.lang.Object add(java.lang.Object a, java.lang.Object b)
public StringTemplate getTemplateInclude(StringTemplate enclosing, java.lang.String templateName, StringTemplateAST argumentsAST)
public int writeAttribute(StringTemplate self, java.lang.Object o, StringTemplateWriter out)
protected int write(StringTemplate self, java.lang.Object o, StringTemplateWriter out, java.lang.Object separator)
protected java.lang.String computeSeparator(StringTemplate self, StringTemplateWriter out, java.lang.Object separator)
protected void evaluateArguments(StringTemplate self)
public static java.lang.Object convertArrayToList(java.lang.Object value)
public java.lang.Object first(java.lang.Object attribute)
public java.lang.Object rest(java.lang.Object attribute)
public java.lang.Object last(java.lang.Object attribute)
public static boolean isValidMapInstance(java.lang.Class type)
public static boolean isValidReturnTypeMapInstance(java.lang.Class type)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |