org.glassfish.gmbal.generic
Class FacetAccessorImpl

java.lang.Object
  extended by org.glassfish.gmbal.generic.FacetAccessorImpl
All Implemented Interfaces:
FacetAccessor

public class FacetAccessorImpl
extends Object
implements FacetAccessor

Author:
ken

Constructor Summary
FacetAccessorImpl(Object delegate)
           
 
Method Summary
<T> void
addFacet(T obj)
          Add a facet to the object.
<T> T
facet(Class<T> cls, boolean debug)
          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, boolean debug)
          Fetch the value of the field from whichever facet contains the field.
 Object invoke(Method method, boolean debug, 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, boolean debug)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FacetAccessorImpl

public FacetAccessorImpl(Object delegate)
Method Detail

facet

public <T> T facet(Class<T> cls,
                   boolean debug)
Description copied from interface: FacetAccessor
Access the Facet of Class T from the object.

Specified by:
facet in interface FacetAccessor
Type Parameters:
T - The Type (as a Class) of the Facet.
Parameters:
cls - The class of the facet.
Returns:
Instance of cls for this facet. Null if no such facet is available.

facets

public Collection<Object> facets()
Description copied from interface: FacetAccessor
Return a list of all facets on this object.

Specified by:
facets in interface FacetAccessor
Returns:
Collection of all facets.

addFacet

public <T> void addFacet(T obj)
Description copied from interface: FacetAccessor
Add a facet to the object. The type T must not already be available as a facet.

Specified by:
addFacet in interface FacetAccessor

invoke

public Object invoke(Method method,
                     boolean debug,
                     Object... args)
Description copied from interface: FacetAccessor
Invoke method on the appropriate facet of this object, that is, on the facet corresponding to method.getDeclaringClass.

Specified by:
invoke in interface FacetAccessor
Parameters:
method - The method to invoke.
args - Arguments to the method.
Returns:
restult of the invoke call.

get

public Object get(Field field,
                  boolean debug)
Description copied from interface: FacetAccessor
Fetch the value of the field from whichever facet contains the field. Read-only because that's all that the intended application needs.

Specified by:
get in interface FacetAccessor
Parameters:
field - The field to access
debug - True if debugging trace output is desired
Returns:
The value of the field

set

public void set(Field field,
                Object value,
                boolean debug)
Specified by:
set in interface FacetAccessor

removeFacet

public void removeFacet(Class<?> cls)
Description copied from interface: FacetAccessor
Remove the facet (if any) of the given type.

Specified by:
removeFacet in interface FacetAccessor
Parameters:
cls - The class of the facet to remove.


Copyright © 2005-2015 Oracle Corporation. All Rights Reserved.