ch.elca.el4j.util.metadata.annotations
Class Annotations

java.lang.Object
  extended by ch.elca.el4j.util.metadata.annotations.Annotations
All Implemented Interfaces:
Attributes

public class Annotations
extends Object
implements Attributes

Helper class to get annotations of a field, method, and class. Annotations can also fetched filtered.

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

Constructor Summary
Annotations()
           
 
Method Summary
protected  Collection filter(Collection c, Class filter)
          Filters the given collection.
 Collection getAttributes(Class targetClass)
          Return the class attributes of the target class.
 Collection getAttributes(Class targetClass, Class filter)
          Return the class attributes of the target class of a given type.
 Collection getAttributes(Field targetField)
          Return the field attributes of the target field.
 Collection getAttributes(Field targetField, Class filter)
          Return the field attributes of the target method of a given type.
 Collection getAttributes(Method targetMethod)
          Return the method attributes of the target method.
 Collection getAttributes(Method targetMethod, Class filter)
          Return the method attributes of the target method of a given type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Annotations

public Annotations()
Method Detail

getAttributes

public Collection getAttributes(Class targetClass)
Return the class attributes of the target class.

Specified by:
getAttributes in interface Attributes
Parameters:
targetClass - the class that contains attribute information
Returns:
a collection of attributes, possibly an empty collection, never null

getAttributes

public Collection getAttributes(Method targetMethod)
Return the method attributes of the target method.

Specified by:
getAttributes in interface Attributes
Parameters:
targetMethod - the method that contains attribute information
Returns:
a Collection of attributes, possibly an empty Collection, never null

getAttributes

public Collection getAttributes(Field targetField)
Return the field attributes of the target field.

Specified by:
getAttributes in interface Attributes
Parameters:
targetField - the field that contains attribute information
Returns:
a Collection of attribute, possibly an empty Collection, never null

getAttributes

public Collection getAttributes(Class targetClass,
                                Class filter)
Return the class attributes of the target class of a given type.

The class attributes are filtered by providing a Class reference to indicate the type to filter on. This is useful if you know the type of the attribute you are looking for and don't want to sort through the unfiltered Collection yourself.

Specified by:
getAttributes in interface Attributes
Parameters:
targetClass - the class that contains attribute information
filter - specify that only this type of class should be returned
Returns:
return only the Collection of attributes that are of the filter type

getAttributes

public Collection getAttributes(Method targetMethod,
                                Class filter)
Return the method attributes of the target method of a given type.

The method attributes are filtered by providing a Class reference to indicate the type to filter on. This is useful if you know the type of the attribute you are looking for and don't want to sort through the unfiltered Collection yourself.

Specified by:
getAttributes in interface Attributes
Parameters:
targetMethod - the method that contains attribute information
filter - specify that only this type of class should be returned
Returns:
a Collection of attributes, possibly an empty Collection, never null

getAttributes

public Collection getAttributes(Field targetField,
                                Class filter)
Return the field attributes of the target method of a given type.

The field attributes are filtered by providing a Class reference to indicate the type to filter on. This is useful if you know the type of the attribute you are looking for and don't want to sort through the unfiltered Collection yourself.

Specified by:
getAttributes in interface Attributes
Parameters:
targetField - the field that contains attribute information
filter - specify that only this type of class should be returned
Returns:
a Collection of attributes, possibly an empty Collection, never null

filter

protected Collection filter(Collection c,
                            Class filter)
Filters the given collection. Only items assignable to the given filter class will stay in collection.

Parameters:
c - Is the collection to filter.
filter - Is the class used for filtering.
Returns:
Returns the filtered collection.


Copyright © 2005-2011 ELCA. All Rights Reserved.