public class LocalNumberConverter
extends com.opensymphony.xwork2.conversion.impl.NumberConverter
classpath:xwork-conversion.properties file :
java.lang.Double=org.nuiton.web.struts2.converters.LocalNumberConverter java.lang.Integer=org.nuiton.web.struts2.converters.LocalNumberConverter
classpath:struts.xml file :
You may tune this converter to your needs by overriding some methods like
formatNullValue(),
getMinDecimals() or getMaxDecimals()| Modifier and Type | Field and Description |
|---|---|
protected DecimalFormat |
doubleFormat
|
protected DecimalFormat |
integerFormat
|
| Constructor and Description |
|---|
LocalNumberConverter() |
| Modifier and Type | Method and Description |
|---|---|
protected Number |
convertToNumber(String string,
Class toType) |
protected String |
convertToString(Object value) |
Object |
convertValue(Map<String,Object> context,
Object target,
Member member,
String propertyName,
Object value,
Class toType) |
protected String |
formatNullValue()
Result if formatted object is null.
|
protected DecimalFormat |
getDoubleFormat() |
protected DecimalFormat |
getIntegerFormat() |
protected int |
getMaxDecimals() |
protected int |
getMinDecimals() |
protected boolean |
isNullValue(String string)
Method to know if a given string should be interpreted as "no value".
|
protected DecimalFormat integerFormat
protected DecimalFormat doubleFormat
protected DecimalFormat getIntegerFormat()
protected DecimalFormat getDoubleFormat()
public Object convertValue(Map<String,Object> context, Object target, Member member, String propertyName, Object value, Class toType)
convertValue in interface com.opensymphony.xwork2.conversion.TypeConverterconvertValue in class com.opensymphony.xwork2.conversion.impl.NumberConverterprotected String formatNullValue()
isNullValue(String) tooprotected boolean isNullValue(String string)
protected int getMinDecimals()
protected int getMaxDecimals()
Copyright © 2010–2014 CodeLutin. All rights reserved.