svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.expressionevaluator / org.gvsig.expressionevaluator.lib / org.gvsig.expressionevaluator.lib.impl / src / main / java / org / gvsig / expressionevaluator / impl / function / programming / $IdentifierFunction.java @ 46050
History | View | Annotate | Download (1.37 KB)
1 | 44138 | jjdelcerro | package org.gvsig.expressionevaluator.impl.function.programming; |
---|---|---|---|
2 | 43512 | jjdelcerro | |
3 | import org.apache.commons.lang3.Range; |
||
4 | 44138 | jjdelcerro | import org.gvsig.expressionevaluator.Function; |
5 | 43521 | jjdelcerro | import org.gvsig.expressionevaluator.Interpreter; |
6 | 43512 | jjdelcerro | import org.gvsig.expressionevaluator.spi.AbstractFunction; |
7 | 46050 | omartinez | import static org.gvsig.expressionevaluator.ExpressionBuilder.FUNCTION_$CONSTANT; |
8 | import static org.gvsig.expressionevaluator.ExpressionBuilder.FUNCTION_$IDENTIFIER; |
||
9 | 43512 | jjdelcerro | |
10 | 46050 | omartinez | public class $IdentifierFunction extends AbstractFunction { |
11 | 43512 | jjdelcerro | |
12 | 46050 | omartinez | public $IdentifierFunction() { |
13 | super(Function.GROUP_PROGRAMMING,
|
||
14 | FUNCTION_$IDENTIFIER,
|
||
15 | 44269 | omartinez | Range.is(1),
|
16 | 46010 | jjdelcerro | "Evaluate the parameter as a string and return the value of the variable referred by this string.\n" +
|
17 | "This function is used to mark that the result of evaluate the parameter must be "+
|
||
18 | "converted to a variable identifier when generating the SQL expression. ",
|
||
19 | 46050 | omartinez | FUNCTION_$IDENTIFIER+"({{expression}})", |
20 | 44138 | jjdelcerro | null,
|
21 | 44269 | omartinez | "Object",
|
22 | 44207 | jjdelcerro | false
|
23 | 43512 | jjdelcerro | ); |
24 | } |
||
25 | 44138 | jjdelcerro | |
26 | 43512 | jjdelcerro | @Override
|
27 | 44009 | jjdelcerro | public boolean allowConstantFolding() { |
28 | 44138 | jjdelcerro | return false; |
29 | } |
||
30 | 44009 | jjdelcerro | |
31 | @Override
|
||
32 | 44138 | jjdelcerro | public Object call(Interpreter interpreter, final Object[] args) throws Exception { |
33 | 46010 | jjdelcerro | String identifier = this.getStr(args, 0); |
34 | return interpreter.getSymbolTable().value(identifier);
|
||
35 | 43512 | jjdelcerro | } |
36 | 44138 | jjdelcerro | |
37 | 43512 | jjdelcerro | |
38 | } |