Package com.github.mustachejava.reflect
Class BaseObjectHandler
java.lang.Object
com.github.mustachejava.reflect.BaseObjectHandler
- All Implemented Interfaces:
ObjectHandler
- Direct Known Subclasses:
ReflectionObjectHandler,SimpleObjectHandler,TypeCheckingHandler
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancheckClass(Class sClass) protected voidcheckField(Field member) protected voidcheckMethod(Method member) Coerce results to Java native iterables, functions, callables.abstract BindingcreateBinding(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.Call Iteration.next() either 0 (true) or 1 (fale) times.protected AccessibleObjectfindMember(Class sClass, String name) private AccessibleObjectfindMemberOnClass(Class sClass, String name) protected Fieldprotected MethodIterate over an object by calling Iteration.next for each value.Turns an object into the string representation that should be displayed in templates.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.github.mustachejava.ObjectHandler
find
-
Constructor Details
-
BaseObjectHandler
public BaseObjectHandler()
-
-
Method Details
-
coerce
Description copied from interface:ObjectHandlerCoerce results to Java native iterables, functions, callables.- Specified by:
coercein interfaceObjectHandler- Parameters:
object- transform an unknown type to a known type- Returns:
- the new object
-
falsey
Description copied from interface:ObjectHandlerCall Iteration.next() either 0 (true) or 1 (fale) times.- Specified by:
falseyin interfaceObjectHandler- Parameters:
iteration- callback for the next iterationwriter- the writer to write toobject- the current objectscopes- the scopes present- Returns:
- the current writer
-
createBinding
Description copied from interface:ObjectHandlerEach call site has its own binding to allow for fine grained caching without a separate parallel hierarchy of objects.- Specified by:
createBindingin interfaceObjectHandler- Parameters:
name- the name that we boundtc- the textual context of the binding sitecode- the code that was bound- Returns:
- the binding
-
iterate
Description copied from interface:ObjectHandlerIterate over an object by calling Iteration.next for each value.- Specified by:
iteratein interfaceObjectHandler- Parameters:
iteration- callback for the next iterationwriter- the writer to write toobject- the current objectscopes- the scopes present- Returns:
- the current writer
-
getField
- Throws:
NoSuchFieldException
-
getMethod
protected Method getMethod(Class<?> aClass, String name, Class<?>... params) throws NoSuchMethodException - Throws:
NoSuchMethodException
-
findMember
-
findMemberOnClass
-
checkMethod
- Throws:
NoSuchMethodException
-
checkField
- Throws:
NoSuchFieldException
-
checkClass
-
stringify
Description copied from interface:ObjectHandlerTurns an object into the string representation that should be displayed in templates.- Specified by:
stringifyin interfaceObjectHandler- Parameters:
object- the object to be displayed- Returns:
- a string representation of the object.
-