M
- The member type.public abstract class MemberValueResolver<M extends Member> extends Object implements ValueResolver
ValueResolver
that is built on top of reflections
API. It use an internal cache for saving members
.UNRESOLVED, VALUE_RESOLVERS
Constructor and Description |
---|
MemberValueResolver() |
Modifier and Type | Method and Description |
---|---|
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.
|
Set<Map.Entry<String,Object>> |
propertySet(Object context)
List all the properties and their values for the given object.
|
Object |
resolve(Object context)
Resolve the the context object by optionally converting the value if necessary.
|
Object |
resolve(Object context,
String name)
Resolve the attribute's name in the context object.
|
public final Object resolve(Object context, String name)
ValueResolver
ValueResolver.UNRESOLVED
is returned, the
context stack
will
continue with the next value resolver in the chain.resolve
in interface ValueResolver
context
- 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.public Object resolve(Object context)
ValueResolver
ValueResolver.UNRESOLVED
is returned, the context stack
will continue with
the next value resolver in the chain.resolve
in interface ValueResolver
context
- The context object. 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 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.public Set<Map.Entry<String,Object>> propertySet(Object context)
ValueResolver
propertySet
in interface ValueResolver
context
- The context object. Not null.Copyright © 2021. All rights reserved.