Class MemberValueResolver<M extends Member>
java.lang.Object
com.github.jknack.handlebars.context.MemberValueResolver<M>
- Type Parameters:
M- The member type.
- All Implemented Interfaces:
ValueResolver
- Direct Known Subclasses:
FieldValueResolver,MethodValueResolver
A specialization of
ValueResolver that is built on top of reflections
API. It use an internal cache for saving members.- Since:
- 0.1.1
-
Field Summary
Fields inherited from interface com.github.jknack.handlebars.ValueResolver
UNRESOLVED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract booleanTrue, if the member matches the one we look for.propertySet(Object context) List all the properties and their values for the given object.Resolve the the context object by optionally converting the value if necessary.final ObjectResolve the attribute's name in the context object.
-
Constructor Details
-
MemberValueResolver
public MemberValueResolver()
-
-
Method Details
-
resolve
Description copied from interface:ValueResolverResolve the attribute's name in the context object. If aValueResolver.UNRESOLVEDis returned, thecontext stackwill continue with the next value resolver in the chain.- Specified by:
resolvein interfaceValueResolver- Parameters:
context- The context object. Not null.name- The attribute's name. Not null.- Returns:
- A
ValueResolver.UNRESOLVEDis returned, thecontext stackwill continue with the next value resolver in the chain. Otherwise, it returns the associated value.
-
resolve
Description copied from interface:ValueResolverResolve the the context object by optionally converting the value if necessary. If aValueResolver.UNRESOLVEDis returned, thecontext stackwill continue with the next value resolver in the chain.- Specified by:
resolvein interfaceValueResolver- Parameters:
context- The context object. Not null.- Returns:
- A
ValueResolver.UNRESOLVEDis returned, thecontext stackwill continue with the next value resolver in the chain. Otherwise, it returns the associated value.
-
matches
True, if the member matches the one we look for.- Parameters:
member- The classMember.name- The attribute's name.- Returns:
- True, if the member matches the one we look for.
-
propertySet
Description copied from interface:ValueResolverList all the properties and their values for the given object.- Specified by:
propertySetin interfaceValueResolver- Parameters:
context- The context object. Not null.- Returns:
- All the properties and their values for the given object.
-