it.eng.spago.validation.fieldvalidators
Class DecimalValidator

java.lang.Object
  extended byit.eng.spago.dispatching.service.DefaultRequestContext
      extended byit.eng.spago.validation.fieldvalidators.AbstractFieldValidator
          extended byit.eng.spago.validation.fieldvalidators.NumericValidator
              extended byit.eng.spago.validation.fieldvalidators.DecimalValidator
All Implemented Interfaces:
FieldValidatorIFace, RequestContextIFace, java.io.Serializable

public class DecimalValidator
extends NumericValidator

Author:
zoppello This class checks if a field is a valid decimal number and perform additional checks on the exact number of decimals after decimal separator and on the maximum number of decimal after the decimal separator This implementation need that this validator should be configured with parameters regarding language and country, with this information the notion of "decimal separator" will depend on Locale object istantiate using this information For Example: If the config section the Italian Locale will be used This Validator will convert the original value in a java.lang.Double object if it succeed and this will be putted in TYPED_SERVICE_REQUEST with an alias if this is configured in validation.xml file
See Also:
Serialized Form

Field Summary
static java.lang.String ERROR_MAX_DECIMALS
           
static java.lang.String ERROR_MAXDECIMALS_IDENTIFIER
           
static java.lang.String ERROR_REQUIRED_DECIMALS
           
static java.lang.String ERROR_REQUIRED_DECIMALS_IDENTIFIER
           
 
Fields inherited from class it.eng.spago.validation.fieldvalidators.NumericValidator
ERROR_MAXVALUE_IDENTIFIER, ERROR_MIN_MAX_VALUE_IDENTIFIER, ERROR_MINVALUE_IDENTIFIER, ERRORE_CAMPO_NUMERICO, ERRORE_MAX_VALUE, ERRORE_MIN_MAX_VALUE, ERRORE_MIN_VALUE
 
Fields inherited from class it.eng.spago.validation.fieldvalidators.AbstractFieldValidator
DEFAULT_VALUE_IDENTIFIER, GENERIC_ERROR_IDENTIFIER, TYPED_SERVICE_REQUEST
 
Constructor Summary
DecimalValidator()
           
 
Method Summary
 void handleDecimals(SourceBean serviceRequest, java.lang.String fieldName, java.lang.String value, java.util.Map fieldValidationParams, char decimalSeparator, java.util.List params)
          Handle optional checks on the decimal part of the number
 
Methods inherited from class it.eng.spago.validation.fieldvalidators.NumericValidator
validateField
 
Methods inherited from class it.eng.spago.validation.fieldvalidators.AbstractFieldValidator
getConfig, getErrorCode, getUserFieldName, init, saveTypedValue, setDefault
 
Methods inherited from class it.eng.spago.dispatching.service.DefaultRequestContext
getErrorHandler, getRequestContainer, getResponseContainer, getServiceRequest, getServiceResponse, setRequestContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR_MAXDECIMALS_IDENTIFIER

public static final java.lang.String ERROR_MAXDECIMALS_IDENTIFIER
See Also:
Constant Field Values

ERROR_REQUIRED_DECIMALS_IDENTIFIER

public static final java.lang.String ERROR_REQUIRED_DECIMALS_IDENTIFIER
See Also:
Constant Field Values

ERROR_MAX_DECIMALS

public static final java.lang.String ERROR_MAX_DECIMALS
See Also:
Constant Field Values

ERROR_REQUIRED_DECIMALS

public static final java.lang.String ERROR_REQUIRED_DECIMALS
See Also:
Constant Field Values
Constructor Detail

DecimalValidator

public DecimalValidator()
Method Detail

handleDecimals

public void handleDecimals(SourceBean serviceRequest,
                           java.lang.String fieldName,
                           java.lang.String value,
                           java.util.Map fieldValidationParams,
                           char decimalSeparator,
                           java.util.List params)
                    throws EMFValidationError
Description copied from class: NumericValidator
Handle optional checks on the decimal part of the number

Overrides:
handleDecimals in class NumericValidator
Throws:
EMFValidationError
See Also:
FieldValidatorIFace.validateField(it.eng.spago.base.SourceBean, java.lang.String, java.lang.String, java.util.Map)