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