public abstract class BaseObjectHandler extends Object implements ObjectHandler
Constructor and Description |
---|
BaseObjectHandler() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkField(Field member) |
protected void |
checkMethod(Method member) |
Object |
coerce(Object object)
Coerce results to Java native iterables, functions, callables.
|
abstract Binding |
createBinding(String name,
TemplateContext tc,
Code code)
Each call site has its own binding to allow for fine grained caching without
a separate parallel hierarchy of objects.
|
Writer |
falsey(Iteration iteration,
Writer writer,
Object object,
List<Object> scopes)
Call Iteration.next() either 0 (true) or 1 (fale) times.
|
protected AccessibleObject |
findMember(Class sClass,
String name) |
protected Field |
getField(Class aClass,
String name) |
protected Method |
getMethod(Class<?> aClass,
String name,
Class<?>... params) |
Writer |
iterate(Iteration iteration,
Writer writer,
Object object,
List<Object> scopes)
Iterate over an object by calling Iteration.next for each value.
|
String |
stringify(Object object)
Turns an object into the string representation that should be displayed
in templates.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
find, makeList
public Object coerce(Object object)
ObjectHandler
coerce
in interface ObjectHandler
object
- transform an unknown type to a known typepublic Writer falsey(Iteration iteration, Writer writer, Object object, List<Object> scopes)
ObjectHandler
falsey
in interface ObjectHandler
iteration
- callback for the next iterationwriter
- the writer to write toobject
- the current objectscopes
- the scopes presentpublic abstract Binding createBinding(String name, TemplateContext tc, Code code)
ObjectHandler
createBinding
in interface ObjectHandler
name
- the name that we boundtc
- the textual context of the binding sitecode
- the code that was boundpublic Writer iterate(Iteration iteration, Writer writer, Object object, List<Object> scopes)
ObjectHandler
iterate
in interface ObjectHandler
iteration
- callback for the next iterationwriter
- the writer to write toobject
- the current objectscopes
- the scopes presentprotected Field getField(Class aClass, String name) throws NoSuchFieldException
NoSuchFieldException
protected Method getMethod(Class<?> aClass, String name, Class<?>... params) throws NoSuchMethodException
NoSuchMethodException
protected AccessibleObject findMember(Class sClass, String name)
protected void checkMethod(Method member) throws NoSuchMethodException
NoSuchMethodException
protected void checkField(Field member) throws NoSuchFieldException
NoSuchFieldException
public String stringify(Object object)
ObjectHandler
stringify
in interface ObjectHandler
object
- the object to be displayedCopyright © 2018. All rights reserved.