- Author
- Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g
Definition at line 31 of file Localizer.java.
◆ Localizer()
org.turro.elephant.impl.util.Localizer.Localizer |
( |
IConstructor |
constructor | ) |
|
◆ parseString() [1/2]
String org.turro.elephant.impl.util.Localizer.parseString |
( |
String |
type, |
|
|
String |
inFormat, |
|
|
String |
outFormat, |
|
|
String |
value |
|
) |
| |
Definition at line 39 of file Localizer.java.
45 String format = I_.compatibility().get(
"fmt." + inFormat);
46 if(format ==
null) format = inFormat;
47 if(
"date".equals(type)) {
48 SimpleDateFormat sdfi =
new SimpleDateFormat(
49 (format ==
null ? ObjectString.DEFAULT_DATE : format)
51 return parseValue(type, outFormat, sdfi.parse(value));
53 else if(
"number".equals(type)) {
54 Number number = (Number)ObjectString.parseNativeString(value, Double.class,
true);
57 else if(
"bytes".equals(type)) {
58 Long bytes = (Long)ObjectString.parseNativeString(value, Long.class,
true);
63 }
catch(Exception ex) {
String parseValue(String type, String outFormat, Object value)
◆ parseString() [2/2]
Object org.turro.elephant.impl.util.Localizer.parseString |
( |
String |
type, |
|
|
String |
inFormat, |
|
|
String |
value |
|
) |
| |
Definition at line 68 of file Localizer.java.
73 String format = I_.compatibility().get(
"fmt." + inFormat);
74 if(format ==
null) format = inFormat;
75 if(
"date".equals(type)) {
76 SimpleDateFormat sdfi =
new SimpleDateFormat(
77 (format ==
null ? ObjectString.DEFAULT_DATE : format)
79 return sdfi.parse(value);
81 else if(
"number".equals(type)) {
82 Number number = (Number)ObjectString.parseNativeString(value, Double.class,
true);
85 else if(
"bytes".equals(type)) {
86 Long bytes = (Long)ObjectString.parseNativeString(value, Long.class,
true);
91 }
catch(Exception ex) {
◆ parseValue()
String org.turro.elephant.impl.util.Localizer.parseValue |
( |
String |
type, |
|
|
String |
outFormat, |
|
|
Object |
value |
|
) |
| |
Definition at line 96 of file Localizer.java.
101 if(
"date".equals(type)) {
102 outFormat = I_.compatibility().get(
"fmt." + outFormat);
103 SimpleDateFormat sdfo =
new SimpleDateFormat(
104 (outFormat ==
null ? ObjectString.DATE_PATTERN : outFormat),
105 new java.util.Locale(I_.compatibility().get(
"fmt.locale"))
107 return sdfo.format(value);
109 else if(
"number".equals(type)) {
110 outFormat = I_.compatibility().get(
"fmt." + outFormat);
111 NumberFormat dfo = NumberFormat.getInstance(
112 new java.util.Locale(I_.compatibility().get(
"fmt.locale"))
114 if(dfo instanceof DecimalFormat) {
115 ((DecimalFormat)dfo).applyPattern(
116 (outFormat ==
null ? ObjectString.DEFAULT_NUMBER : outFormat)
119 return dfo.format(value);
121 else if(
"bytes".equals(type)) {
122 return new org.turro.formatter.BytesFormatter(((Long)value).longValue()).toString();
125 return value.toString();
126 }
catch(Exception ex) {
◆ constructor
IConstructor org.turro.elephant.impl.util.Localizer.constructor |
|
protected |
The documentation for this class was generated from the following file: