org.apache.commons.attributes

Class AttributeUtil


public class AttributeUtil
extends java.lang.Object

Commonly used convenience functions.
Since:
2.1

Method Summary

static Collection
getClassesWithAttributeType(Collection classes, Class attributeClass)
Filters a Collection of Class objects.
static Collection
getObjectsWithAttributeType(Collection objects, Class attributeClass)
Filters a collection of objects.

Method Details

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.
Parameters:
classes - Collection of Classes to filter. May contain null references, but may not itself be null.
attributeClass - the class to filter based on.
Since:
2.1

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.
Parameters:
objects - Collection of objects to filter. May contain null references, but may not itself be null.
attributeClass - the class to filter based on.
Since:
2.1