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