|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.github.jknack.handlebars.context.MemberValueResolver<M>
M - The member type.public abstract class MemberValueResolver<M extends Member>
A specialization of ValueResolver that is built on top of reflections
API. It use an internal cache for saving members.
| Field Summary |
|---|
| Fields inherited from interface com.github.jknack.handlebars.ValueResolver |
|---|
UNRESOLVED, VALUE_RESOLVERS |
| Constructor Summary | |
|---|---|
MemberValueResolver()
|
|
| Method Summary | |
|---|---|
protected M |
find(Class<?> clazz,
String name)
Find a Member in the given class. |
protected abstract Object |
invokeMember(M member,
Object context)
Invoke the member in the given context. |
protected boolean |
isPrivate(M member)
True if the member is private. |
protected boolean |
isProtected(M member)
True if the member is protected. |
protected boolean |
isPublic(M member)
True if the member is public. |
protected boolean |
isStatic(M member)
True if the member is static. |
abstract boolean |
matches(M member,
String name)
True, if the member matches the one we look for. |
protected abstract String |
memberName(M member)
Get the name for the given member. |
protected abstract Set<M> |
members(Class<?> clazz)
List all the possible members for the given class. |
protected Set<M> |
membersFromCache(Class<?> clazz)
List all the possible members for the given class. |
Set<Map.Entry<String,Object>> |
propertySet(Object context)
List all the properties and their values for the given object. |
Object |
resolve(Object context,
String name)
Resolve the attribute's name in the context object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MemberValueResolver()
| Method Detail |
|---|
public final Object resolve(Object context,
String name)
ValueResolverValueResolver.UNRESOLVED is returned, the
context stack will
continue with the next value resolver in the chain.
resolve in interface ValueResolvercontext - The context object. Not null.name - The attribute's name. Not null.
ValueResolver.UNRESOLVED is returned, the context
stack will continue with the next value resolver in the chain.
Otherwise, it returns the associated value.
protected final M find(Class<?> clazz,
String name)
Member in the given class.
clazz - The context's class.name - The attribute's name.
Member or null.
protected abstract Object invokeMember(M member,
Object context)
member - The class member.context - The context object.
public abstract boolean matches(M member,
String name)
member - The class Member.name - The attribute's name.
protected boolean isPublic(M member)
member - The member object.
protected boolean isPrivate(M member)
member - The member object.
protected boolean isProtected(M member)
member - The member object.
protected boolean isStatic(M member)
member - The member object.
protected abstract Set<M> members(Class<?> clazz)
clazz - The base class.
protected Set<M> membersFromCache(Class<?> clazz)
clazz - The base class.
public Set<Map.Entry<String,Object>> propertySet(Object context)
ValueResolver
propertySet in interface ValueResolvercontext - The context object. Not null.
protected abstract String memberName(M member)
member - A class member.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||