org.apache.beehive.controls.api.properties
Class PropertySetProxy<T extends Annotation>

Object
  extended by PropertySetProxy<T>
All Implemented Interfaces:
InvocationHandler

public class PropertySetProxy<T extends Annotation>
extends Object
implements InvocationHandler

The PropertySetProxy class is a dynamic proxy InvocationHandler class that exposes the values held within a PropertyMap as an Object implementing an annotation type interface.

This enables properties resolved using the PropertyMap's hiearchical resolution mechanism to be exposed to the client of the proxy in the same way that Java 5 annotations are exposed using raw Java reflection APIs. A proxy of this type should behave identically to the one returned from a call to AnnotatedElement.getAnnotation(), but backed by a richer, more dynamic resolution mechanism.

See Also:
Proxy, InvocationHandler, AnnotatedElement.getAnnotation(java.lang.Class), PropertySet, PropertyMap

Method Summary
 PropertyMap getPropertyMap()
          Returns the underlying PropertyMap containing the property values exposed by the proxy.
 Class<T> getPropertySet()
          Returns the PropertySet annotation type associated with the proxy
static
<T extends Annotation>
T
getProxy(Class<T> propertySet, PropertyMap propertyMap)
          Creates a new proxy instance implementing the PropertySet interface and backed by the data from the property map.
 Object invoke(Object proxy, Method method, Object[] args)
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getProxy

public static <T extends Annotation> T getProxy(Class<T> propertySet,
                                                PropertyMap propertyMap)
Creates a new proxy instance implementing the PropertySet interface and backed by the data from the property map.

Parameters:
propertySet - an annotation type that has the PropertySet meta-annotation
propertyMap - the PropertyMap containing property values backing the proxy
Returns:
proxy that implements the PropertySet interface

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws Throwable
Specified by:
invoke in interface InvocationHandler
Throws:
Throwable

getPropertySet

public Class<T> getPropertySet()
Returns the PropertySet annotation type associated with the proxy


getPropertyMap

public PropertyMap getPropertyMap()
Returns the underlying PropertyMap containing the property values exposed by the proxy.