|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.antlr.stringtemplate.language.AttributeReflectionController
This class knows how to recursively walk a StringTemplate and all of its attributes to dump a type tree out. STs contain attributes which can contain multiple values. Those values could be other STs or have types that are aggregates (have properties). Those types could have properties etc... I am not using ST itself to print out the text for $attributes$ because it kept getting into nasty self-recursive loops that made my head really hurt. Pretty hard to get ST to print itselt out. Oh well, it was a cool thought while I had it. I just dump raw text to an output buffer now. Easier to understand also.
Field Summary | |
protected int |
indentation
Can't use ST to output so must do our own indentation |
protected java.util.Stack |
itemIndexStack
If in a list, itemIndex=1..n; used to print ordered list in indent(). |
protected java.lang.StringBuffer |
output
Build up a string buffer as you walk the nested data structures |
protected StringTemplate |
st
|
protected java.util.Set |
typesVisited
To avoid infinite loops with cyclic type refs, track the types |
Constructor Summary | |
AttributeReflectionController(StringTemplate st)
|
Method Summary | |
protected java.lang.Object |
getRawValue(java.lang.Object value,
java.lang.reflect.Method method)
Normally we don't actually get the value of properties since we can use normal reflection to get the list of properties of the return type. |
protected void |
incItemIndex()
|
protected void |
indent()
|
boolean |
isAtomicType(java.lang.Class type)
For now, assume only java.lang stuff is atomic as long as it's not a valid map. |
protected void |
restoreItemIndex()
|
protected void |
saveItemIndex()
|
static java.lang.String |
terseType(java.lang.String typeName)
|
java.lang.String |
toString()
|
void |
walkAtomicType(java.lang.Class type)
|
void |
walkAttributes(StringTemplate st)
Walk all the attributes in this template, spitting them out. |
void |
walkAttributeValues(java.lang.Object attributeValue)
|
void |
walkMap(java.util.Map map)
Walk all the attributes in this template, spitting them out. |
void |
walkPropertiesList(java.lang.Object aggregateValue,
java.lang.Class type)
Get the list of properties by looking for get/isXXX methods. |
void |
walkStringTemplate(StringTemplate st)
|
void |
walkValue(java.lang.Object value,
java.lang.Class type)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.util.Set typesVisited
protected java.lang.StringBuffer output
protected int indentation
protected java.util.Stack itemIndexStack
protected StringTemplate st
Constructor Detail |
public AttributeReflectionController(StringTemplate st)
Method Detail |
public java.lang.String toString()
public void walkStringTemplate(StringTemplate st)
public void walkAttributes(StringTemplate st)
public void walkAttributeValues(java.lang.Object attributeValue)
public void walkPropertiesList(java.lang.Object aggregateValue, java.lang.Class type)
public void walkValue(java.lang.Object value, java.lang.Class type)
public void walkAtomicType(java.lang.Class type)
public void walkMap(java.util.Map map)
public boolean isAtomicType(java.lang.Class type)
public static java.lang.String terseType(java.lang.String typeName)
protected java.lang.Object getRawValue(java.lang.Object value, java.lang.reflect.Method method)
protected void indent()
protected void incItemIndex()
protected void saveItemIndex()
protected void restoreItemIndex()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |