Top Description Methods
org.stringtemplate.v4

public Interface ModelAdaptor<T>

Known Direct Implementers
org.stringtemplate.v4.misc.AggregateModelAdaptor, org.stringtemplate.v4.misc.MapModelAdaptor, org.stringtemplate.v4.misc.ObjectModelAdaptor, org.stringtemplate.v4.misc.STModelAdaptor
Type Parameters
<T>
the type of values this adaptor can handle.
Imports
org.stringtemplate.v4.misc.STNoSuchPropertyException, java.util.Map

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 type M with property method M.foo() (as opposed to M.getFoo()), we can register a model adaptor object, adap, that converts a lookup for property foo into a call to M.foo().

Given <a.foo>, we look up foo via the adaptor if a instanceof M.

Method Summary

Modifier and TypeMethod and Description
public Object
getProperty(Interpreter interp, ST self, T model, Object property, String propertyName)

Lookup property name in o and return its value.

Method Detail

getPropertyback to summary
public Object getProperty(Interpreter interp, ST self, T model, Object property, String propertyName) throws STNoSuchPropertyException

Lookup property name in o and return its value.

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.