Interface Resolver
-
- All Known Implementing Classes:
ArrayResolver
,BeanResolver
,HeadersResolver
,HeapResolver
,ListResolver
,MapResolver
,PrincipalResolver
,RequestResolver
public interface Resolver extends Indexed<Class>
Exposes an object's elements for access through dynamic expressions and scripts.
-
-
Field Summary
Fields Modifier and Type Field Description static Object
UNRESOLVED
Singleton that is returned to indicate an element is not resolved by a resolver.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Object
get(Object object, Object element)
Attempts to resolve an element of an object.Class<?>
getKey()
Returns the type of object that the resolver supports.Object
put(Object object, Object element, Object value)
Attempts to set the value of an element of an object.
-
-
-
Field Detail
-
UNRESOLVED
static final Object UNRESOLVED
Singleton that is returned to indicate an element is not resolved by a resolver.
-
-
Method Detail
-
getKey
Class<?> getKey()
Returns the type of object that the resolver supports. This does not necessarily guarantee that the resolver will provide resolution; rather this is how a resolver specifies what type of object it may resolve. Resolvers for more specific classes and interfaces are called earlier than those of more general classes and interfaces.
-
get
Object get(Object object, Object element)
Attempts to resolve an element of an object. Theobject
argument references an object for which a named or indexed element is being requested. Theelement
argument specifies the element that is being requested from the referenced object.The
element
argument can be either aString
or anInteger
object. A string represents a named element of an associative array; an integer represents the index of an ordered array.If the resolver cannot resolve the requested element, then
UNRESOLVED
should be returned. This allows other resovlers of more generic classes or interfaces to potentially resolve the requested element.- Parameters:
object
- the object in which to resolve the specified element.element
- the element to resolve within the specified object.- Returns:
- the value of the resolved element, or
UNRESOLVED
if it cannot be resolved.
-
put
Object put(Object object, Object element, Object value)
Attempts to set the value of an element of an object. Theobject
argument references an object for which a named or indexed element is to be set. Theelement
argument specifies which element value is to be set. Thevalue
argument specifies the value to be set.The
element
argument can be either aString
or anInteger
object. A string represents a named element of an associative array; an integer represents the index of an ordered array.If the resolver cannot resolve the requested element or set its value, then
UNRESOLVED
should be returned. This allows other resovlers of more generic classes or interfaces to potentially resolve the requested element.- Parameters:
object
- the object in which to resolve the specified element.element
- the element within the specified object whose value is to be set.value
- the value to set the element to.- Returns:
- the previous value of the element,
null
if no previous value, orUNRESOLVED
if it cannot be resolved.
-
-