public class FacetAccessorImpl extends java.lang.Object implements FacetAccessor
Constructor and Description |
---|
FacetAccessorImpl(java.lang.Object delegate) |
Modifier and Type | Method and Description |
---|---|
<T> void |
addFacet(T obj)
Add a facet to the object.
|
<T> T |
facet(java.lang.Class<T> cls)
Access the Facet of Class T from the object.
|
java.util.Collection<java.lang.Object> |
facets()
Return a list of all facets on this object.
|
java.lang.Object |
get(java.lang.reflect.Field field)
Fetch the value of the field from whichever facet contains the field.
|
java.lang.Object |
invoke(java.lang.reflect.Method method,
java.lang.Object... args)
Invoke method on the appropriate facet of this
object, that is, on the facet corresponding to
method.getDeclaringClass.
|
void |
removeFacet(java.lang.Class<?> cls)
Remove the facet (if any) of the given type.
|
void |
set(java.lang.reflect.Field field,
java.lang.Object value) |
public <T> T facet(java.lang.Class<T> cls)
FacetAccessor
facet
in interface FacetAccessor
T
- The Type (as a Class) of the Facet.cls
- The class of the facet.public java.util.Collection<java.lang.Object> facets()
FacetAccessor
facets
in interface FacetAccessor
public <T> void addFacet(T obj)
FacetAccessor
addFacet
in interface FacetAccessor
public java.lang.Object invoke(java.lang.reflect.Method method, java.lang.Object... args)
FacetAccessor
invoke
in interface FacetAccessor
method
- The method to invoke.args
- Arguments to the method.public java.lang.Object get(java.lang.reflect.Field field)
FacetAccessor
get
in interface FacetAccessor
field
- The field to accesspublic void set(java.lang.reflect.Field field, java.lang.Object value)
set
in interface FacetAccessor
public void removeFacet(java.lang.Class<?> cls)
FacetAccessor
removeFacet
in interface FacetAccessor
cls
- The class of the facet to remove.