org.stringtemplate.v4.misc
Class ObjectModelAdaptor

java.lang.Object
  extended by org.stringtemplate.v4.misc.ObjectModelAdaptor
All Implemented Interfaces:
ModelAdaptor

public class ObjectModelAdaptor
extends java.lang.Object
implements ModelAdaptor


Field Summary
protected  org.antlr.runtime.misc.DoubleKeyMap<java.lang.Class,java.lang.String,java.lang.reflect.Member> classAndPropertyToMemberCache
          Cache exact attribute type and property name reflection Member object
 
Constructor Summary
ObjectModelAdaptor()
           
 
Method Summary
 java.lang.Object getProperty(Interpreter interp, ST self, java.lang.Object o, java.lang.Object property, java.lang.String propertyName)
          Lookup property name in o and return its value.
 java.lang.Object lookupMethod(java.lang.Object o, java.lang.String propertyName, java.lang.Object value, java.lang.Class c)
           
protected  java.lang.Object throwNoSuchProperty(java.lang.String propertyName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classAndPropertyToMemberCache

protected org.antlr.runtime.misc.DoubleKeyMap<java.lang.Class,java.lang.String,java.lang.reflect.Member> classAndPropertyToMemberCache
Cache exact attribute type and property name reflection Member object

Constructor Detail

ObjectModelAdaptor

public ObjectModelAdaptor()
Method Detail

getProperty

public java.lang.Object getProperty(Interpreter interp,
                                    ST self,
                                    java.lang.Object o,
                                    java.lang.Object property,
                                    java.lang.String propertyName)
                             throws STNoSuchPropertyException
Description copied from interface: ModelAdaptor
Lookup property name in o and return its value. It's a good idea to cache a Method or Field reflection object to make this fast after the first look up. property is normally a String but doesn't have to be. E.g., if o is Map, property could be any key type. If we need to convert to string, then it's done by ST and passed in here.

Specified by:
getProperty in interface ModelAdaptor
Throws:
STNoSuchPropertyException

lookupMethod

public java.lang.Object lookupMethod(java.lang.Object o,
                                     java.lang.String propertyName,
                                     java.lang.Object value,
                                     java.lang.Class c)

throwNoSuchProperty

protected java.lang.Object throwNoSuchProperty(java.lang.String propertyName)


Copyright © 2011. All Rights Reserved.