@Test public void sortTest() { ValueArray array = ValueFactory.createValueArray(Arrays.asList("aa", "bb", "ab", "ba")); ValueFilterSort sort = new ValueFilterSort(); assertEquals("should sort array correctly", "[aa, ab, ba, bb]", sort.filterValue(array).toString()); }
@Override public ValueObject filterValue(ValueObject value) { if (value == null) { return null; } ValueObject.TYPE type = value.getObjectType(); switch (type) { case ARRAY: return sortArray(value.asArray()); case INT: return value; case FLOAT: return value; case STRING: return value; default: throw new RuntimeException("Unsupported object type " + type); } }
ValueFilterSort extends AbstractValueFilter { @Override public ValueObject filterValue(ValueObject value) { if (value == null) { return null; } ValueObject.TYPE type = value.getObjectType(); switch (type) { case ARRAY: return sortArray(value.asArray()); case INT: return value; case FLOAT: return value; case STRING: return value; default: throw new RuntimeException("Unsupported object type " + type); } } }
ValueFilterSort extends AbstractValueFilter { @Override public ValueObject filterValue(ValueObject value) { if (value == null) { return null; } ValueObject.TYPE type = value.getObjectType(); switch (type) { case ARRAY: return sortArray(value.asArray()); case INT: return value; case FLOAT: return value; case STRING: return value; default: throw new RuntimeException("Unsupported object type " + type); } }  }
ValueFilterSort extends AbstractValueFilter { @Override public ValueObject filterValue(ValueObject value) { if (value == null) { return null; } ValueObject.TYPE type = value.getObjectType(); switch (type) { case ARRAY: return sortArray(value.asArray()); case INT: return value; case FLOAT: return value; case STRING: return value; default: throw new RuntimeException("Unsupported object type " + type); } }  @Override ValueObject filterValue(ValueObject value); static ValueArray sortArray(ValueArray array); }
ValueFilterSort extends AbstractValueFilter { @Override public ValueObject filterValue(ValueObject value) { if (value == null) { return null; } ValueObject.TYPE type = value.getObjectType(); switch (type) { case ARRAY: return sortArray(value.asArray()); case INT: return value; case FLOAT: return value; case STRING: return value; default: throw new RuntimeException("Unsupported object type " + type); } }  @Override ValueObject filterValue(ValueObject value); static ValueArray sortArray(ValueArray array);  }