root / trunk / libraries / libExpressions / src / main / java / org / gvsig / operators / ToUpperCase.java @ 23299
History | View | Annotate | Download (1.55 KB)
1 | 23299 | jcampos | package org.gvsig.operators; |
---|---|---|---|
2 | |||
3 | import org.apache.bsf.BSFException; |
||
4 | import org.apache.bsf.BSFManager; |
||
5 | import org.gvsig.baseclasses.AbstractOperator; |
||
6 | import org.gvsig.baseclasses.IOperator; |
||
7 | import org.gvsig.expresions.EvalOperatorsTask; |
||
8 | |||
9 | import com.iver.andami.PluginServices; |
||
10 | |||
11 | /**
|
||
12 | * @author Vicente Caballero Navarro
|
||
13 | */
|
||
14 | public class ToUpperCase extends AbstractOperator{ |
||
15 | |||
16 | public String addText(String s) { |
||
17 | return toString()+"("+s+")"; |
||
18 | } |
||
19 | public String toString() { |
||
20 | return "toUpperCase"; |
||
21 | } |
||
22 | public void eval(BSFManager interpreter) throws BSFException { |
||
23 | // interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"String toUpperCase(String value){return value.toUpperCase();};");
|
||
24 | interpreter.exec(EvalOperatorsTask.JYTHON,null,-1,-1,"def toUpperCase(value):\n" + |
||
25 | " return value.upper()");
|
||
26 | } |
||
27 | public boolean isEnable() { |
||
28 | return (getType()==IOperator.STRING);
|
||
29 | } |
||
30 | public String getDescription() { |
||
31 | return PluginServices.getText(this, "parameter") + ": " + |
||
32 | PluginServices.getText(this, "string_value") + "\n" + |
||
33 | PluginServices.getText(this, "returns") + ": " + |
||
34 | PluginServices.getText(this, "string_value") + "\n" + |
||
35 | PluginServices.getText(this, "description") + ": " + |
||
36 | "Converts all of the characters in this String to upper case using the rules of the given Locale.\n" +
|
||
37 | "Case mappings rely heavily on the Unicode specification's character data.\n" +
|
||
38 | "Since case mappings are not always 1:1 char mappings, the resulting String may be a different length than the original String.";
|
||
39 | } |
||
40 | } |