O
- type of data to decoratepublic class JXPathDecorator<O> extends Decorator<O>
String.format(String, Object...)
method.
To use it, give to him a expression where all jxpath to apply on bean are
boxed in ${}
.
After the jxpath token you must specifiy the formatter to apply of the
jxpath token.
For example :
Decorator<Object> d = DecoratorUtil.newJXPathDecorator( JXPathDecorator.class,"expr = ${expressions}$s"); assert "expr = %1$s" == d.getExpression(); assert 1 == d.getNbToken(); assert java.util.Arrays.asList("expression") == d.getTokens(); assert "expr = %1$s" == d.toString(d);
Decorator
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
JXPathDecorator.Context<O> |
static class |
JXPathDecorator.JXPathComparator<O> |
Modifier and Type | Field and Description |
---|---|
protected JXPathDecorator.Context<O> |
context
the computed context of the decorator
|
protected String |
initialExpression
the initial expression used to compute the decorator context.
|
protected int |
nbToken
nb jxpath tokens to compute
|
Modifier | Constructor and Description |
---|---|
protected |
JXPathDecorator(Class<O> internalClass,
String expression,
JXPathDecorator.Context<O> context) |
Modifier and Type | Method and Description |
---|---|
protected static void |
ensureTokenIndex(JXPathDecorator<?> decorator,
int pos) |
protected Comparator<O> |
getComparator(int pos) |
String |
getExpression() |
String |
getInitialExpression() |
int |
getNbToken() |
String |
getProperty(int pos) |
String[] |
getTokens() |
protected Comparable<Comparable<?>> |
getTokenValue(org.apache.commons.jxpath.JXPathContext jxcontext,
String token) |
void |
setContext(JXPathDecorator.Context<O> context) |
String |
toString() |
String |
toString(Object bean) |
protected JXPathDecorator.Context<O> context
protected int nbToken
protected String initialExpression
protected JXPathDecorator(Class<O> internalClass, String expression, JXPathDecorator.Context<O> context) throws IllegalArgumentException, NullPointerException
public String getProperty(int pos)
public String getExpression()
public String[] getTokens()
public int getNbToken()
public String getInitialExpression()
public void setContext(JXPathDecorator.Context<O> context)
protected Comparator<O> getComparator(int pos)
protected Comparable<Comparable<?>> getTokenValue(org.apache.commons.jxpath.JXPathContext jxcontext, String token)
protected static void ensureTokenIndex(JXPathDecorator<?> decorator, int pos)
Copyright © 2013–2015 CodeLutin. All rights reserved.