public class StringValuePropertyDef extends PropertyDef<String> implements SortingPropertyExtractor<Object>
PropertyDef representing the String value of an object using Object#toString().
Instances also serve as a SortingPropertyExtractor that can actually extract the property from any object.
createPropertySORT_BY_NAME| Constructor and Description |
|---|
StringValuePropertyDef(String name)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canSort(PropertyDef<?> propertyDef)
Determine if the given property can be sorted by this instance.
|
<V> V |
getPropertyValue(Object obj,
PropertyDef<V> propertyDef)
Read the value of the property defined by
propertyDef from the given object. |
int |
sort(PropertyDef<?> propertyDef,
Object obj1,
Object obj2)
Sort two values based on the given property.
|
addTo, addTo, addTo, cast, createProperty, createProperty, createProperty, equals, get, get, getDefaultValue, getName, getPropertyId, getType, hashCode, isSortable, read, sort, toStringpublic StringValuePropertyDef(String name)
name - property name; also serves as the property IDpublic <V> V getPropertyValue(Object obj, PropertyDef<V> propertyDef)
PropertyExtractorpropertyDef from the given object.getPropertyValue in interface PropertyExtractor<Object>V - value typeobj - Java objectpropertyDef - definition of which property to readpublic boolean canSort(PropertyDef<?> propertyDef)
SortingPropertyExtractorComparable.canSort in interface SortingPropertyExtractor<Object>propertyDef - definition of propertypropertyDef can be sorted by this instancepublic int sort(PropertyDef<?> propertyDef, Object obj1, Object obj2)
SortingPropertyExtractorsort in interface SortingPropertyExtractor<Object>propertyDef - definition of property to sort onobj1 - first Java objectobj2 - second Java objectobj1's property value to obj2's property valueCopyright © 2017. All rights reserved.