Package com.thingworx.types.data.sorters
Class GenericSorter
java.lang.Object
com.thingworx.types.data.sorters.GenericSorter
- All Implemented Interfaces:
ISort
,Comparator<ValueCollection>
@ThingworxExtensionApiClass(since={6,6},
canInstantiate=true)
public final class GenericSorter
extends Object
implements ISort
General purpose sorter for a single data field.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGenericSorter
(String fieldName, boolean ascending) GenericSorter
(String fieldName, boolean ascending, boolean caseSensitive) -
Method Summary
Modifier and TypeMethodDescriptionint
compare
(ValueCollection row1, ValueCollection row2) boolean
boolean
void
resolveFields
(DataShapeDefinition metadata) void
setAscending
(boolean value) void
setFieldName
(String value) org.json.JSONObject
toJSON()
Produces JSON representation of this sorter.org.json.JSONArray
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
ASCENDING
public static final boolean ASCENDING- See Also:
-
DESCENDING
public static final boolean DESCENDING- See Also:
-
-
Constructor Details
-
GenericSorter
-
GenericSorter
@ThingworxExtensionApiMethod(since={6,6}) public GenericSorter(String fieldName, boolean ascending, boolean caseSensitive) -
GenericSorter
-
-
Method Details
-
getFieldName
- Specified by:
getFieldName
in interfaceISort
-
setFieldName
- Specified by:
setFieldName
in interfaceISort
-
isAscending
- Specified by:
isAscending
in interfaceISort
-
setAscending
- Specified by:
setAscending
in interfaceISort
-
resolveFields
- Specified by:
resolveFields
in interfaceISort
-
compare
@ThingworxExtensionApiMethod(since={6,6}) public int compare(ValueCollection row1, ValueCollection row2) - Specified by:
compare
in interfaceComparator<ValueCollection>
-
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
-