org.proteios
Class ClassDescriptor
java.lang.Object
org.proteios.ClassDescriptor
public class ClassDescriptor
- extends Object
Through the ClassDescriptor you can find methods by defined attributes.
- Author:
- gregory
- See Also:
AttributeDefinition
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ClassDescriptor
public ClassDescriptor(Class<?> cls)
- Parameters:
cls - to describe
getReadMethod
public Method getReadMethod(AttributeDefinition atr)
throws SecurityException,
NoSuchMethodException
- Throws:
SecurityException
NoSuchMethodException
getWriteMethod
public Method getWriteMethod(AttributeDefinition atr)
throws SecurityException,
NoSuchMethodException
- Throws:
SecurityException
NoSuchMethodException
getAttributes
public List<AttributeDefinition> getAttributes(AttributeFilter filter)
- Parameters:
filter - to apply
- Returns:
- a list of attributes filtered through the above filter
sort
public List<AttributeDefinition> sort(List<AttributeDefinition> attributes,
List<String> order)
- Returns a filtered list of attributes.
- Parameters:
attributes - List of attribute definitions to be sorted.order - List of column key strings in desired sort order.
- Returns:
- List Sorted list of attribute definitions.
getAttributes
public List<AttributeDefinition> getAttributes()
- Currently supports Primitive, Nameable and Enumerated attributes
- Returns:
- list of readable attributes, those with 'get' or 'is' prefixes,
or null if none are found.
getDescribedClass
public Class<?> getDescribedClass()
readValue
public Object readValue(Object obj,
AttributeDefinition attributeDefinition)
- Parameters:
obj - to read the attribute ofattributeDefinition - describing the attribute
- Returns:
- the value of that attribute or null