com.amazon.carbonado.info
Class StorablePropertyAdapter

java.lang.Object
  extended by com.amazon.carbonado.info.StorablePropertyAdapter

public class StorablePropertyAdapter
extends Object

Information about an adapter annotation applied to a property.

Author:
Brian S O'Neill

Constructor Summary
StorablePropertyAdapter(String propertyName, Class<?> propertyType, Class<? extends Annotation> adapterType)
          Construct a generic StorablePropertyAdapter instance not attached to a storable definition.
 
Method Summary
 Method findAdaptMethod(Class from, Class to)
          Returns an adapt method that supports the given conversion, or null if none.
 Method[] findAdaptMethodsFrom(Class from)
          Returns all the adapt methods that convert from the given type.
 Method[] findAdaptMethodsTo(Class to)
          Returns all the adapt methods that convert to the given type.
 Constructor getAdapterConstructor()
          Returns the constructor for the adapter class.
 Object getAdapterInstance()
          Returns an instance of the adapter, for which an adapt method is applied to.
 Method getAdaptMethod(int index)
          Returns a specific adapt method.
 int getAdaptMethodCount()
          Returns the count of all defined adapt methods.
 Method[] getAdaptMethods()
          Returns a new array with all the adapt methods in it.
 StorablePropertyAnnotation getAnnotation()
          Returns the annotation that applied this adapter, or null if none.
 Class[] getStorageTypePreferences()
          Returns the adapter's storage type preferences.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StorablePropertyAdapter

public StorablePropertyAdapter(String propertyName,
                               Class<?> propertyType,
                               Class<? extends Annotation> adapterType)
Construct a generic StorablePropertyAdapter instance not attached to a storable definition. Call StorableProperty.getAdapter() to gain access to adapter information on actual storable definitions.

Parameters:
propertyName - name of property with adapter
propertyType - declated type of adapted property
adapterType - adapter type
Throws:
IllegalArgumentException - if adapterType is not an adapter definition.
Method Detail

getAnnotation

public StorablePropertyAnnotation getAnnotation()
Returns the annotation that applied this adapter, or null if none.


getAdapterConstructor

public Constructor getAdapterConstructor()
Returns the constructor for the adapter class. It has the signature (Class type, String propertyName, Annotation), where Annotation is the fully resolved annotation.


getAdapterInstance

public Object getAdapterInstance()
Returns an instance of the adapter, for which an adapt method is applied to.


getStorageTypePreferences

public Class[] getStorageTypePreferences()
Returns the adapter's storage type preferences.

See Also:
AdapterDefinition.storageTypePreferences()

findAdaptMethod

public Method findAdaptMethod(Class from,
                              Class to)
Returns an adapt method that supports the given conversion, or null if none.


findAdaptMethodsFrom

public Method[] findAdaptMethodsFrom(Class from)
Returns all the adapt methods that convert from the given type.


findAdaptMethodsTo

public Method[] findAdaptMethodsTo(Class to)
Returns all the adapt methods that convert to the given type.


getAdaptMethodCount

public int getAdaptMethodCount()
Returns the count of all defined adapt methods.


getAdaptMethod

public Method getAdaptMethod(int index)
                      throws IndexOutOfBoundsException
Returns a specific adapt method.

Throws:
IndexOutOfBoundsException

getAdaptMethods

public Method[] getAdaptMethods()
Returns a new array with all the adapt methods in it.



Copyright © 2006-2009 Amazon Technologies, Inc.. All Rights Reserved.