Package com.github.mustachejava
Class TypeCheckingHandler
java.lang.Object
com.github.mustachejava.reflect.BaseObjectHandler
com.github.mustachejava.TypeCheckingHandler
- All Implemented Interfaces:
ObjectHandler
Rather than pulling values this looks only at types. To check if a template matches the shape
of your view classes, pass in the set of classes you expect to have at runtime in the scope.
User: sam
Date: 2/3/13
Time: 9:43 AM
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateBinding(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.Find a value named "name" in the array of scopes in reverse order.Iterate 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 com.github.mustachejava.reflect.BaseObjectHandler
checkClass, checkField, checkMethod, coerce, findMember, getField, getMethod
-
Constructor Details
-
TypeCheckingHandler
public TypeCheckingHandler()
-
-
Method Details
-
find
Description copied from interface:ObjectHandlerFind a value named "name" in the array of scopes in reverse order.- Parameters:
name- the variable namescopes- the ordered list of scopes- Returns:
- a wrapper that can be used to extract a value
-
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- Specified by:
createBindingin classBaseObjectHandler- Parameters:
name- the name that we boundtc- the textual context of the binding sitecode- the code that was bound- Returns:
- the binding
-
falsey
Description copied from interface:ObjectHandlerCall Iteration.next() either 0 (true) or 1 (fale) times.- Specified by:
falseyin interfaceObjectHandler- Overrides:
falseyin classBaseObjectHandler- Parameters:
iteration- callback for the next iterationwriter- the writer to write toobject- the current objectscopes- the scopes present- Returns:
- the current writer
-
iterate
Description copied from interface:ObjectHandlerIterate over an object by calling Iteration.next for each value.- Specified by:
iteratein interfaceObjectHandler- Overrides:
iteratein classBaseObjectHandler- Parameters:
iteration- callback for the next iterationwriter- the writer to write toobject- the current objectscopes- the scopes present- Returns:
- the current writer
-
stringify
Description copied from interface:ObjectHandlerTurns an object into the string representation that should be displayed in templates.- Specified by:
stringifyin interfaceObjectHandler- Overrides:
stringifyin classBaseObjectHandler- Parameters:
object- the object to be displayed- Returns:
- a string representation of the object.
-