Package com.github.mustachejava.reflect
Class SimpleObjectHandler
- java.lang.Object
-
- com.github.mustachejava.reflect.BaseObjectHandler
-
- com.github.mustachejava.reflect.SimpleObjectHandler
-
- All Implemented Interfaces:
ObjectHandler
public class SimpleObjectHandler extends BaseObjectHandler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classSimpleObjectHandler.WrapperKey
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<SimpleObjectHandler.WrapperKey,java.lang.reflect.AccessibleObject>cacheprivate static java.lang.reflect.AccessibleObjectNONE
-
Constructor Summary
Constructors Constructor Description SimpleObjectHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanareMethodsAccessible(java.util.Map<?,?> map)BindingcreateBinding(java.lang.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.Wrapperfind(java.lang.String name, java.util.List<java.lang.Object> scopes)Find a value named "name" in the array of scopes in reverse order.private java.lang.reflect.AccessibleObjectlookup(java.lang.Class sClass, java.lang.String name)-
Methods inherited from class com.github.mustachejava.reflect.BaseObjectHandler
checkClass, checkField, checkMethod, coerce, falsey, findMember, getField, getMethod, iterate, stringify
-
-
-
-
Field Detail
-
cache
private java.util.Map<SimpleObjectHandler.WrapperKey,java.lang.reflect.AccessibleObject> cache
-
NONE
private static java.lang.reflect.AccessibleObject NONE
-
-
Method Detail
-
createBinding
public Binding createBinding(java.lang.String name, TemplateContext tc, Code code)
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
-
find
public Wrapper find(java.lang.String name, java.util.List<java.lang.Object> scopes)
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
-
lookup
private java.lang.reflect.AccessibleObject lookup(java.lang.Class sClass, java.lang.String name)
-
areMethodsAccessible
protected boolean areMethodsAccessible(java.util.Map<?,?> map)
-
-