Package io.vertigo.basics.formatter
Class FormatterNumber
- java.lang.Object
-
- io.vertigo.basics.formatter.FormatterNumber
-
- All Implemented Interfaces:
Formatter
- Direct Known Subclasses:
FormatterNumberLocalized
public class FormatterNumber extends Object implements Formatter
Gestion des formatages de nombres. L'argument est obligatoire, il permet de préciser le format d'affichage des nombres. A l'affichage - le séparateur de millier est un espace - le séparateur décimal est une virgule En saisie - les séparateurs de milliers acceptés sont l'espace et l'espace insécable - les séparateurs décimaux acceptés sont la virgule et le point Exemple d'argument : #,###,##0.00- Author:
- pchretien
-
-
Constructor Summary
Constructors Constructor Description FormatterNumber(String args)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static StringcleanStringNumber(String sValue, char decimalCharUsed, char groupCharUsed)Simplifie une chaine réprésentant un nombre.protected StringcleanStringNumber(String value, DecimalFormatSymbols decimalFormatSymbols)Simplifie une chaine réprésentant un nombre.protected DecimalFormatSymbolsgetDecimalFormatSymbols()StringgetPattern()protected voidinitParameters(String args)ObjectstringToValue(String strValue, io.vertigo.core.lang.BasicType dataType)StringvalueToString(Object objValue, io.vertigo.core.lang.BasicType dataType)
-
-
-
Constructor Detail
-
FormatterNumber
public FormatterNumber(String args)
Constructor. This formatter requires one arg that is a pattern. This pattern is used - to format a string into a number - to format a number into a string- Parameters:
args- args used to initialize the formatter
-
-
Method Detail
-
getPattern
public final String getPattern()
- Returns:
- Pattern
-
initParameters
protected final void initParameters(String args)
- Parameters:
args- args
-
getDecimalFormatSymbols
protected DecimalFormatSymbols getDecimalFormatSymbols()
- Returns:
- Symboles decimaux utilisés
-
stringToValue
public final Object stringToValue(String strValue, io.vertigo.core.lang.BasicType dataType) throws FormatterException
- Specified by:
stringToValuein interfaceFormatter- Throws:
FormatterException
-
cleanStringNumber
protected String cleanStringNumber(String value, DecimalFormatSymbols decimalFormatSymbols)
Simplifie une chaine réprésentant un nombre. Utilisé en préprocessing avant le parsing.- Parameters:
value- Chaine saisiedecimalFormatSymbols- symboles décimaux utilisées- Returns:
- Chaine simplifiée
-
cleanStringNumber
protected static final String cleanStringNumber(String sValue, char decimalCharUsed, char groupCharUsed)
Simplifie une chaine réprésentant un nombre. Utilisé en préprocessing avant le parsing.- Parameters:
sValue- Chaine saisiedecimalCharUsed- caractère décimal utiliségroupCharUsed- caractère de millier utilisé- Returns:
- Chaine simplifiée
-
valueToString
public final String valueToString(Object objValue, io.vertigo.core.lang.BasicType dataType)
- Specified by:
valueToStringin interfaceFormatter
-
-