ch.elca.el4j.util.metadata
Class DefaultGenericMetaDataSource

java.lang.Object
  extended by ch.elca.el4j.util.metadata.DefaultGenericMetaDataSource
All Implemented Interfaces:
GenericMetaDataSource
Direct Known Subclasses:
TransactionMetaDataSource

public class DefaultGenericMetaDataSource
extends Object
implements GenericMetaDataSource

The default implementation of the GenericAttributeSource interface.

Author:
Raphael Boog (RBO), Martin Zeltner (MZE)
File-location:
DefaultGenericMetaDataSource
Last check-in date:
2010-01-15 12:21:07 +0100 (Fr, 15. Jan 2010) by jonasha for revision 4091

Field Summary
protected  Map<String,Collection> m_cache
          Cache of Attributes, keyed by Method and target class.
protected static Collection NULL_METADATA
          Canonical value held in cache to indicate that no metadata was found for a method.
 
Constructor Summary
DefaultGenericMetaDataSource()
           
 
Method Summary
protected  Collection computeMetaData(Method method, Class targetClass)
          Same as method getMetaData(Method, Class) but without caching of the result.
protected  Collection filterMetaData(Collection metaData)
           
protected  Collection findAllAttributes(Class clazz)
           
protected  Collection findAllAttributes(Method m)
           
protected  String getCacheKey(Method method, Class targetClass)
          Calculates the cache key of a certain method in a certain class.
 List<Class> getInterceptingMetaData()
          
 Collection getMetaData(Method method, Class targetClass)
          
 Attributes getMetaDataDelegator()
          Getter method to get the metadata implementation.
 void setInterceptingMetaData(List<Class> interceptedAttributes)
          Setter method for the list of metadata types where to apply the interceptor.
 void setMetaDataDelegator(Attributes metaDataDelegator)
          Setter method to set the metadata implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_METADATA

protected static final Collection NULL_METADATA
Canonical value held in cache to indicate that no metadata was found for a method. So we don't need to look for metadata again.


m_cache

protected final Map<String,Collection> m_cache
Cache of Attributes, keyed by Method and target class.

Constructor Detail

DefaultGenericMetaDataSource

public DefaultGenericMetaDataSource()
Method Detail

getCacheKey

protected String getCacheKey(Method method,
                             Class targetClass)
Calculates the cache key of a certain method in a certain class.

Parameters:
method - method for the current invocation.
targetClass - targetClass for this invocation. May be null.
Returns:
Returns the cache key string.

getMetaData

public Collection getMetaData(Method method,
                              Class targetClass)

Specified by:
getMetaData in interface GenericMetaDataSource
Parameters:
method - Is the method for the current invocation. Must not be null.
targetClass - target class for this invocation. May be null.
Returns:
Returns a collection of the matching meta data for the given method and targetClass.

computeMetaData

protected Collection computeMetaData(Method method,
                                     Class targetClass)
Same as method getMetaData(Method, Class) but without caching of the result.

Parameters:
method - Is the method for the current invocation. Must not be null.
targetClass - target class for this invocation. May be null.
Returns:
Returns a collection of the matching meta data for the given method and targetClass.

findAllAttributes

protected Collection findAllAttributes(Method m)
Parameters:
m - Is the method to retrieve metadata for.
Returns:
Returns all found metadata associated with the given method or null if no metadata could be found.

findAllAttributes

protected Collection findAllAttributes(Class clazz)
Parameters:
clazz - Is the class to retrieve metadata for.
Returns:
Returns all found metadata associated with the given class or null if no metadata could be found.

filterMetaData

protected Collection filterMetaData(Collection metaData)
Parameters:
metaData - Are the metadata to filter.
Returns:
Returns the filtered collection of metadata or null if the returned collection would be empty. Only intercepting metadata will endure the filter process.

getMetaDataDelegator

public Attributes getMetaDataDelegator()
Description copied from interface: GenericMetaDataSource
Getter method to get the metadata implementation.

Specified by:
getMetaDataDelegator in interface GenericMetaDataSource
Returns:
Returns the metaDataDelegator.

setMetaDataDelegator

public void setMetaDataDelegator(Attributes metaDataDelegator)
Description copied from interface: GenericMetaDataSource
Setter method to set the metadata implementation.

Specified by:
setMetaDataDelegator in interface GenericMetaDataSource
Parameters:
metaDataDelegator - Is the metaDataDelegator to set.

getInterceptingMetaData

public List<Class> getInterceptingMetaData()

Specified by:
getInterceptingMetaData in interface GenericMetaDataSource
Returns:
Returns the metadata type list.

setInterceptingMetaData

public void setInterceptingMetaData(List<Class> interceptedAttributes)
Setter method for the list of metadata types where to apply the interceptor.

Specified by:
setInterceptingMetaData in interface GenericMetaDataSource
Parameters:
interceptedAttributes - Is the metadata type list.


Copyright © 2005-2011 ELCA. All Rights Reserved.