Package io.vertigo.basics.formatter
Class FormatterNumber
java.lang.Object
io.vertigo.basics.formatter.FormatterNumber
- All Implemented Interfaces:
Formatter
- Direct Known Subclasses:
FormatterNumberLocalized
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 -
Method Summary
Modifier and TypeMethodDescriptionprotected static final 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 DecimalFormatSymbolsfinal Stringprotected final voidinitParameters(String args) final ObjectstringToValue(String strValue, io.vertigo.core.lang.BasicType dataType) final StringvalueToString(Object objValue, io.vertigo.core.lang.BasicType dataType)
-
Constructor Details
-
FormatterNumber
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 Details
-
getPattern
- Returns:
- Pattern
-
initParameters
- Parameters:
args- args
-
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
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
- Specified by:
valueToStringin interfaceFormatter
-