Package org.stringtemplate.v4
Interface ModelAdaptor<T>
-
- Type Parameters:
T- the type of values this adaptor can handle.
- All Known Implementing Classes:
AggregateModelAdaptor,MapModelAdaptor,ObjectModelAdaptor,STModelAdaptor
public interface ModelAdaptor<T>An object that knows how to convert property references to appropriate actions on a model object. Some models, like JDBC, are interface based (we aren't supposed to care about implementation classes). Some other models don't follow StringTemplate's getter method naming convention. So, if we have an object of typeMwith property methodM.foo()(as opposed toM.getFoo()), we can register a model adaptor object,adap, that converts a lookup for propertyfoointo a call toM.foo().Given
<a.foo>, we look upfoovia the adaptor ifa instanceof M.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ObjectgetProperty(Interpreter interp, ST self, T model, Object property, String propertyName)Lookup property name inoand return its value.
-
-
-
Method Detail
-
getProperty
Object getProperty(Interpreter interp, ST self, T model, Object property, String propertyName) throws STNoSuchPropertyException
Lookup property name inoand return its value.propertyis normally aStringbut doesn't have to be. E.g., ifoisMap,propertycould be any key type. If we need to convert toString, then it's done bySTand passed in here.- Throws:
STNoSuchPropertyException
-
-