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 / string / UUIDFunction.java @ 45213
History | View | Annotate | Download (733 Bytes)
1 | 43512 | jjdelcerro | package org.gvsig.expressionevaluator.impl.function.string; |
---|---|---|---|
2 | |||
3 | 45132 | jjdelcerro | import java.util.UUID; |
4 | 43512 | jjdelcerro | import org.apache.commons.lang3.Range; |
5 | 45132 | jjdelcerro | import static org.gvsig.expressionevaluator.ExpressionBuilder.FUNCTION_UUID; |
6 | 43521 | jjdelcerro | import org.gvsig.expressionevaluator.Interpreter; |
7 | 43512 | jjdelcerro | import org.gvsig.expressionevaluator.spi.AbstractFunction; |
8 | |||
9 | 45132 | jjdelcerro | public class UUIDFunction extends AbstractFunction { |
10 | 43512 | jjdelcerro | |
11 | 45132 | jjdelcerro | public UUIDFunction() {
|
12 | super("String", FUNCTION_UUID, Range.is(0)); |
||
13 | 43512 | jjdelcerro | } |
14 | |||
15 | @Override
|
||
16 | 44009 | jjdelcerro | public boolean allowConstantFolding() { |
17 | return true; |
||
18 | } |
||
19 | |||
20 | @Override
|
||
21 | 43521 | jjdelcerro | public Object call(Interpreter interpreter, Object[] args) throws Exception { |
22 | 45132 | jjdelcerro | UUID x = UUID.randomUUID(); |
23 | String s = x.toString();
|
||
24 | return s;
|
||
25 | 43512 | jjdelcerro | } |
26 | } |