Package com.thingworx.types.data.sorters
Class GenericSorter
- java.lang.Object
-
- com.thingworx.types.data.sorters.GenericSorter
-
- All Implemented Interfaces:
ISort
,java.util.Comparator<ValueCollection>
@ThingworxExtensionApiClass(since={6,6}, canInstantiate=true) public final class GenericSorter extends java.lang.Object implements ISort
General purpose sorter for a single data field.
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
ASCENDING
static boolean
DESCENDING
-
Constructor Summary
Constructors Constructor Description GenericSorter()
GenericSorter(java.lang.String fieldName, boolean ascending)
GenericSorter(java.lang.String fieldName, boolean ascending, boolean caseSensitive)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(ValueCollection row1, ValueCollection row2)
java.lang.String
getFieldName()
boolean
isAscending()
boolean
isCaseSensitive()
void
resolveFields(DataShapeDefinition metadata)
void
setAscending(boolean value)
void
setFieldName(java.lang.String value)
org.json.JSONObject
toJSON()
Produces JSON representation of this sorter.org.json.JSONArray
toJSONArray()
-
-
-
Field Detail
-
ASCENDING
public static final boolean ASCENDING
- See Also:
- Constant Field Values
-
DESCENDING
public static final boolean DESCENDING
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GenericSorter
@ThingworxExtensionApiMethod(since={6,6}) public GenericSorter(java.lang.String fieldName, boolean ascending)
-
GenericSorter
@ThingworxExtensionApiMethod(since={6,6}) public GenericSorter(java.lang.String fieldName, boolean ascending, boolean caseSensitive)
-
GenericSorter
@ThingworxExtensionApiMethod(since={6,6}) public GenericSorter()
-
-
Method Detail
-
getFieldName
@ThingworxExtensionApiMethod(since={6,6}) public java.lang.String getFieldName()
- Specified by:
getFieldName
in interfaceISort
-
setFieldName
@ThingworxExtensionApiMethod(since={6,6}) public void setFieldName(java.lang.String value)
- Specified by:
setFieldName
in interfaceISort
-
isAscending
@ThingworxExtensionApiMethod(since={6,6}) public boolean isAscending()
- Specified by:
isAscending
in interfaceISort
-
setAscending
@ThingworxExtensionApiMethod(since={6,6}) public void setAscending(boolean value)
- Specified by:
setAscending
in interfaceISort
-
resolveFields
@ThingworxExtensionApiMethod(since={6,6}) public void resolveFields(DataShapeDefinition metadata)
- Specified by:
resolveFields
in interfaceISort
-
compare
@ThingworxExtensionApiMethod(since={6,6}) public int compare(ValueCollection row1, ValueCollection row2)
- Specified by:
compare
in interfacejava.util.Comparator<ValueCollection>
-
isCaseSensitive
@ThingworxExtensionApiMethod(since={6,6}) public boolean isCaseSensitive()
- Specified by:
isCaseSensitive
in interfaceISort
-
toJSON
@ThingworxExtensionApiMethod(since={6,6}) public org.json.JSONObject toJSON() throws org.json.JSONException
Produces JSON representation of this sorter. Fields are as follows:CommonPropertyNames.PROP_FIELDNAME
:getFieldName()
resultCommonPropertyNames.PROP_ISASCENDING
:isAscending()
result, when falseCommonPropertyNames.PROP_ISCASESENSITIVE
:isCaseSensitive()
result, when false
-
toJSONArray
@ThingworxExtensionApiMethod(since={6,6}) public org.json.JSONArray toJSONArray() throws org.json.JSONException
- Specified by:
toJSONArray
in interfaceISort
- Returns:
- JSONArray representation of this sorter
- Throws:
org.json.JSONException
- Upon internal errors
-
-