public class DecoratorUtil extends Object
Decorator to create, and sort data with
decorators.
To create a new decorator, use one of the methods : newPropertyDecorator(Class, String)newJXPathDecorator(Class, String)newMultiJXPathDecorator(Class, String, String))newMultiJXPathDecorator(Class, String, String, String))JXPathDecorator, use the method
sort(JXPathDecorator, List, int).
| Constructor and Description |
|---|
DecoratorUtil() |
| Modifier and Type | Method and Description |
|---|---|
static <O> MultiJXPathDecorator<O> |
cloneDecorator(JXPathDecorator<O> decorator)
Creates a new multijxpath decorator from a given jxpath decorator.
|
static <O> JXPathDecorator.Context<O> |
createJXPathContext(String expression) |
static <O> JXPathDecorator.Context<O>[] |
createMultiJXPathContext(String expression,
String separator,
String separatorReplacement) |
static <O> JXPathDecorator.Context<O>[] |
createMultiJXPathContextKeepingOrder(String expression,
String separator,
String separatorReplacement) |
protected static <O> JXPathDecorator.Context<O>[] |
newInstance(int size) |
static <O> JXPathDecorator<O> |
newJXPathDecorator(Class<O> type,
String expression)
Factory method to instanciate a new
JXPathDecorator for the given
class internalClass and expression. |
static <O> MultiJXPathDecorator<O> |
newMultiJXPathDecorator(Class<O> type,
String expression,
String separator) |
static <O> MultiJXPathDecorator<O> |
newMultiJXPathDecorator(Class<O> type,
String expression,
String separator,
String separatorReplacement)
Build a new multi jx path decorator which uise a cycling order while changing the context index.
|
static <O> MultiJXPathDecorator<O> |
newMultiJXPathDecoratorKeepingOrder(Class<O> type,
String expression,
String separator,
String separatorReplacement)
Build a new multi jx path decorator which keep order of incoming expression while changing the context index.
|
static <O> PropertyDecorator<O> |
newPropertyDecorator(Class<O> type,
String property)
Factory method to instanciate a new
PropertyDecorator for the
given class internlaClass and a readable property name. |
static <O> void |
sort(JXPathDecorator<O> decorator,
List<O> datas,
int pos)
Sort a list of data based on the first token property of a given context
in a given decorator.
|
static <O> void |
sort(JXPathDecorator<O> decorator,
List<O> datas,
int pos,
boolean reverse)
Sort a list of data based on the first token property of a given context
in a given decorator.
|
public static <O> PropertyDecorator<O> newPropertyDecorator(Class<O> type, String property) throws IllegalArgumentException, NullPointerException
PropertyDecorator for the
given class internlaClass and a readable property name.O - the generic type of class to be decorated by the new
decoratortype - the class of the objects decorated by the new
decoratorproperty - the propertyIllegalArgumentException - if the expression is not valid, says:
- a missing right brace was detected.
- a ${ was found in a jxpath token.NullPointerException - if type parameter is null.public static <O> JXPathDecorator<O> newJXPathDecorator(Class<O> type, String expression) throws IllegalArgumentException, NullPointerException
JXPathDecorator for the given
class internalClass and expression.O - the generic type of class to be decorated by the new
decoratortype - the class of the objects decorated by the new
decoratorexpression - the expression to use to decorated objectsIllegalArgumentException - if the expression is not valid, says:
- a missing right brace was detected.
- a ${ was found in a jxpath token.NullPointerException - if type parameter is null.public static <O> MultiJXPathDecorator<O> newMultiJXPathDecorator(Class<O> type, String expression, String separator) throws IllegalArgumentException, NullPointerException
public static <O> MultiJXPathDecorator<O> newMultiJXPathDecorator(Class<O> type, String expression, String separator, String separatorReplacement) throws IllegalArgumentException, NullPointerException
A - B - CWhen setting conext index to 1, then we will us this expression:
B - C - A
O - type of beantype - type of beanexpression - initial expressionseparator - expression context separatorseparatorReplacement - context separator replacement in decoratorIllegalArgumentException - ...NullPointerException - ...public static <O> MultiJXPathDecorator<O> newMultiJXPathDecoratorKeepingOrder(Class<O> type, String expression, String separator, String separatorReplacement) throws IllegalArgumentException, NullPointerException
A - B - CWhen setting conext index to 1, then we will us this expression:
B - A - C
O - type of beantype - type of beanexpression - initial expressionseparator - expression context separatorseparatorReplacement - context separator replacement in decoratorIllegalArgumentException - ...NullPointerException - ...public static <O> MultiJXPathDecorator<O> cloneDecorator(JXPathDecorator<O> decorator)
O - generic type of decorator to clonedecorator - the decorator to clonepublic static <O> void sort(JXPathDecorator<O> decorator, List<O> datas, int pos)
O - type of data to sortdecorator - the decorator to use to sortdatas - the list of data to sortpos - the index of context to used in decorator to obtain
sorted property.public static <O> void sort(JXPathDecorator<O> decorator, List<O> datas, int pos, boolean reverse)
O - type of data to sortdecorator - the decorator to use to sortdatas - the list of data to sortpos - the index of context to used in decorator to obtain
sorted property.reverse - flag to sort in reverse order if sets to truepublic static <O> JXPathDecorator.Context<O> createJXPathContext(String expression)
public static <O> JXPathDecorator.Context<O>[] createMultiJXPathContext(String expression, String separator, String separatorReplacement)
public static <O> JXPathDecorator.Context<O>[] createMultiJXPathContextKeepingOrder(String expression, String separator, String separatorReplacement)
protected static <O> JXPathDecorator.Context<O>[] newInstance(int size)
Copyright © 2013–2015 CodeLutin. All rights reserved.