org.antlr.stringtemplate.language
Class AttributeReflectionController

java.lang.Object
  extended byorg.antlr.stringtemplate.language.AttributeReflectionController

public class AttributeReflectionController
extends java.lang.Object

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.


Constructor Summary
AttributeReflectionController(StringTemplate st)
           
 
Method Summary
 boolean isAtomicType(java.lang.Class type)
          For now, assume only java.lang stuff is atomic as long as it's not a valid map.
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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AttributeReflectionController

public AttributeReflectionController(StringTemplate st)
Method Detail

toString

public java.lang.String toString()

walkStringTemplate

public void walkStringTemplate(StringTemplate st)

walkAttributes

public void walkAttributes(StringTemplate st)
Walk all the attributes in this template, spitting them out.


walkAttributeValues

public void walkAttributeValues(java.lang.Object attributeValue)

walkPropertiesList

public void walkPropertiesList(java.lang.Object aggregateValue,
                               java.lang.Class type)
Get the list of properties by looking for get/isXXX methods. The value is the instance of "type" we are concerned with. Return null if no properties


walkValue

public void walkValue(java.lang.Object value,
                      java.lang.Class type)

walkAtomicType

public void walkAtomicType(java.lang.Class type)

walkMap

public void walkMap(java.util.Map map)
Walk all the attributes in this template, spitting them out.


isAtomicType

public boolean isAtomicType(java.lang.Class type)
For now, assume only java.lang stuff is atomic as long as it's not a valid map.


terseType

public static java.lang.String terseType(java.lang.String typeName)