public class ValueResolver
extends java.lang.Object
Map, then call Map.get(java.lang.Object) to get the
value using the string key as the key.
getkey with the first
letter of key capitalized and non-void return type, then call the
method.
Callable, then the return value from invoking it will be used.| Modifier and Type | Class and Description |
|---|---|
protected static class |
ValueResolver.Key
(model class, property name) combination used to find value fetchers
from cache
|
protected static interface |
ValueResolver.ValueFetcher |
| Modifier and Type | Field and Description |
|---|---|
protected static java.util.Map<ValueResolver.Key,ValueResolver.ValueFetcher> |
fetcherCache |
protected static ValueResolver.ValueFetcher |
MAP_FETCHER |
static java.lang.Object |
NOT_FOUND
special value indicating property was not found
|
| Constructor and Description |
|---|
ValueResolver(java.lang.Object model)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
protected static ValueResolver.ValueFetcher |
createFetcher(ValueResolver.Key key) |
protected ValueResolver.ValueFetcher |
getFetcher(ValueResolver.Key key) |
protected static java.lang.reflect.Field |
getField(java.lang.Class<?> clazz,
java.lang.String name) |
protected static java.lang.reflect.Method |
getMethod(java.lang.Class<?> clazz,
java.lang.String name) |
java.lang.Object |
getValue(java.lang.String name)
Resolves name to value from the object.
|
public static final java.lang.Object NOT_FOUND
protected static final ValueResolver.ValueFetcher MAP_FETCHER
protected static java.util.Map<ValueResolver.Key,ValueResolver.ValueFetcher> fetcherCache
public ValueResolver(java.lang.Object model)
model - object to read values fromprotected static java.lang.reflect.Method getMethod(java.lang.Class<?> clazz,
java.lang.String name)
protected static java.lang.reflect.Field getField(java.lang.Class<?> clazz,
java.lang.String name)
protected static ValueResolver.ValueFetcher createFetcher(ValueResolver.Key key)
protected ValueResolver.ValueFetcher getFetcher(ValueResolver.Key key)
public java.lang.Object getValue(java.lang.String name)
name - name to resolve