org.apache.commons.attributes
Class AttributeUtil
java.lang.Object
org.apache.commons.attributes.AttributeUtil
public class AttributeUtil
extends java.lang.Object
Commonly used convenience functions.
getClassesWithAttributeType
public static Collection getClassesWithAttributeType(Collection classes,
Class attributeClass)
Filters a Collection of Class
objects. The returned collection
only contains those classes that have an attribute of the specified type.
That is, for each Class clazz in the
returned collection,
clazz != null && Attributes.hasAttributeType (clazz, attributeClass)
is true.
classes
- Collection of Classes to filter. May contain null
references,
but may not itself be null
.attributeClass
- the class to filter based on.
getObjectsWithAttributeType
public static Collection getObjectsWithAttributeType(Collection objects,
Class attributeClass)
Filters a collection of objects. The returned collection
only contains those objects whose class have an attribute
of the specified type. That is, for each Object o in the
returned collection,
o != null && Attributes.hasAttributeType (o.getClass (), attributeClass)
is true.
objects
- Collection of objects to filter. May contain null
references,
but may not itself be null
.attributeClass
- the class to filter based on.