Revision 44750 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.h2/src/main/java/org/gvsig/fmap/dal/store/h2/expressionbuilderformatter/Decode.java
Decode.java | ||
---|---|---|
3 | 3 |
import java.util.List; |
4 | 4 |
import java.util.Objects; |
5 | 5 |
import org.apache.commons.lang3.StringUtils; |
6 |
import org.apache.commons.lang3.tuple.Pair; |
|
7 | 6 |
import org.gvsig.expressionevaluator.ExpressionBuilder; |
8 | 7 |
import static org.gvsig.expressionevaluator.ExpressionBuilder.FUNCTION_DECODE; |
9 | 8 |
import org.gvsig.expressionevaluator.ExpressionBuilder.Function; |
... | ... | |
29 | 28 |
public boolean canApply(ExpressionBuilder.Value value) { |
30 | 29 |
if (value instanceof ExpressionBuilder.Function) { |
31 | 30 |
if( StringUtils.equalsIgnoreCase(FUNCTION_DECODE, ((Function) value).name()) ) { |
32 |
List<Pair<String,Value>> parameters = ((Function) value).parameters();
|
|
31 |
List<Value> parameters = ((Function) value).parameters();
|
|
33 | 32 |
if( parameters.size()==2) { |
34 |
Value p1 = parameters.get(0).getValue();
|
|
35 |
Value p2 = parameters.get(1).getValue();
|
|
33 |
Value p1 = parameters.get(0); |
|
34 |
Value p2 = parameters.get(1); |
|
36 | 35 |
if( p1 instanceof ExpressionBuilder.Constant && |
37 | 36 |
p2 instanceof ExpressionBuilder.Constant && |
38 | 37 |
((ExpressionBuilder.Constant)p1).value() instanceof String && |
... | ... | |
52 | 51 |
|
53 | 52 |
@Override |
54 | 53 |
public String format(Value function) { |
55 |
List<Pair<String,Value>> parameters = ((Function) function).parameters();
|
|
56 |
Value p1 = parameters.get(0).getValue();
|
|
54 |
List<Value> parameters = ((Function) function).parameters();
|
|
55 |
Value p1 = parameters.get(0); |
|
57 | 56 |
String p1value = Objects.toString(((ExpressionBuilder.Constant)p1).value(), ""); |
58 | 57 |
String r = "X'"+p1value+"'"; |
59 | 58 |
return r; |
Also available in: Unified diff