Package com.almis.awe.service
Class NumericService
- java.lang.Object
-
- com.almis.awe.config.ServiceConfig
-
- com.almis.awe.service.NumericService
-
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
public class NumericService extends ServiceConfig
Numeric service Class Numeric Utilities for AWE- Author:
- Pablo GARCIA - 16/APR/2012
-
-
Constructor Summary
Constructors Constructor Description NumericService(NumericConfigProperties numericConfigProperties)
Hide the constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
applyPattern(String pattern, Double value)
Fixes an string value for a criteriaString
applyPatternWithLocale(String pattern, Double value, String format)
Fixes a string value for a criteria in a raw pattern with localeString
applyPatternWithLocale(String pattern, Double value, NumberFormat numberFormat)
Fixes a string value for a criteria in a raw pattern with localeString
applyRawPattern(String pattern, Double value)
Fixes a string value for a criteria in a raw pattern Use Locale USString
formatNumber(NumberFormat format, Double value)
Fixes a string value for a criteria in a raw pattern with localeint
getDecimalsNumberInNumericString(String val)
Returns decimals number a string that represents a formatted numericint
getDecimalsNumberInRawNumericString(String val)
Returns decimals number a string that represents a raw formatted numericNumber
parseNumericString(String val)
Parses a string value to a number.Number
parseRawNumericString(String val)
Parses a string value to a number.-
Methods inherited from class com.almis.awe.config.ServiceConfig
containsBean, getApplicationContext, getBean, getBean, getElements, getLocale, getLocale, getProperty, getProperty, getRequest, getSession, setApplicationContext
-
-
-
-
Constructor Detail
-
NumericService
public NumericService(NumericConfigProperties numericConfigProperties)
Hide the constructor- Parameters:
numericConfigProperties
- Numeric configuration properties
-
-
Method Detail
-
applyPattern
public String applyPattern(String pattern, Double value)
Fixes an string value for a criteria- Parameters:
pattern
- pattern to applyvalue
- string number value- Returns:
- number formatted
-
applyRawPattern
public String applyRawPattern(String pattern, Double value)
Fixes a string value for a criteria in a raw pattern Use Locale US- Parameters:
pattern
- Number patternvalue
- String value- Returns:
- Value fixed
-
applyPatternWithLocale
public String applyPatternWithLocale(String pattern, Double value, String format)
Fixes a string value for a criteria in a raw pattern with locale- Parameters:
pattern
- patter to applyvalue
- number valueformat
- LOCALE to apply- Returns:
- String with pattern applied
-
applyPatternWithLocale
public String applyPatternWithLocale(String pattern, Double value, NumberFormat numberFormat)
Fixes a string value for a criteria in a raw pattern with locale- Parameters:
pattern
- patter to applyvalue
- number valuenumberFormat
- LOCALE to apply- Returns:
- String with pattern applied
-
formatNumber
public String formatNumber(NumberFormat format, Double value)
Fixes a string value for a criteria in a raw pattern with locale- Parameters:
format
- Number formatvalue
- number value- Returns:
- Number formatted
-
parseNumericString
public Number parseNumericString(String val) throws ParseException
Parses a string value to a number. It reads the numeric type from numeric.properties- Parameters:
val
- String value with format as defined in numeric.properties- Returns:
- parsedValue parsed number
- Throws:
ParseException
- Error parsing number
-
parseRawNumericString
public Number parseRawNumericString(String val) throws ParseException
Parses a string value to a number. It parses a string that represents a raw formatted numeric- Parameters:
val
- String value with format as defined in numeric.properties- Returns:
- parsedValue parsed number
- Throws:
ParseException
- Error parsing number
-
getDecimalsNumberInNumericString
public int getDecimalsNumberInNumericString(String val)
Returns decimals number a string that represents a formatted numeric- Parameters:
val
- String value with format as defined in numeric.properties- Returns:
- decimals number
-
getDecimalsNumberInRawNumericString
public int getDecimalsNumberInRawNumericString(String val)
Returns decimals number a string that represents a raw formatted numeric- Parameters:
val
- String value with format as defined in numeric.properties- Returns:
- decimals number
-
-