Package com.github.jknack.handlebars
Interface ValueResolver
-
- All Known Implementing Classes:
FieldValueResolver
,JavaBeanValueResolver
,MapValueResolver
,MemberValueResolver
,MethodValueResolver
public interface ValueResolver
A hook interface for resolving values from thecontext stack
.- Since:
- 0.1.1
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.Object
UNRESOLVED
A mark object.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static java.util.List<ValueResolver>
defaultValueResolvers()
Default value resolvers.java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>>
propertySet(java.lang.Object context)
List all the properties and their values for the given object.java.lang.Object
resolve(java.lang.Object context)
Resolve the the context object by optionally converting the value if necessary.java.lang.Object
resolve(java.lang.Object context, java.lang.String name)
Resolve the attribute's name in the context object.
-
-
-
Method Detail
-
resolve
java.lang.Object resolve(java.lang.Object context, java.lang.String name)
Resolve the attribute's name in the context object. If aUNRESOLVED
is returned, thecontext stack
will continue with the next value resolver in the chain.- Parameters:
context
- The context object. Not null.name
- The attribute's name. Not null.- Returns:
- A
UNRESOLVED
is returned, thecontext stack
will continue with the next value resolver in the chain. Otherwise, it returns the associated value.
-
resolve
java.lang.Object resolve(java.lang.Object context)
Resolve the the context object by optionally converting the value if necessary. If aUNRESOLVED
is returned, thecontext stack
will continue with the next value resolver in the chain.- Parameters:
context
- The context object. Not null.- Returns:
- A
UNRESOLVED
is returned, thecontext stack
will continue with the next value resolver in the chain. Otherwise, it returns the associated value.
-
propertySet
java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> propertySet(java.lang.Object context)
List all the properties and their values for the given object.- Parameters:
context
- The context object. Not null.- Returns:
- All the properties and their values for the given object.
-
defaultValueResolvers
static java.util.List<ValueResolver> defaultValueResolvers()
Default value resolvers. Including: -MapValueResolver
-JavaBeanValueResolver
-MethodValueResolver
. On Java 14 or higher.- Returns:
- Immutable list of value resolvers.
-
-