biz.c24.io.api.data
Class ISO4217CurrencyAmountValidator

java.lang.Object
  extended by biz.c24.io.api.data.DefaultValidationRule
      extended by biz.c24.io.api.data.ISO4217CurrencyAmountValidator
All Implemented Interfaces:
ModelComponent, ValidationRule, Validator, Serializable
Direct Known Subclasses:
ISO4217CurrencyAttributeValidator, ISO4217CurrencyValidator, SwiftCurrency_PCT_REN_YLD_Validator

public class ISO4217CurrencyAmountValidator
extends DefaultValidationRule

A class for validating a currency / amount field to ensure that the field value has the correct number of decimal places for its given currency.

This class uses the System property Utils.SYSTEM_PROPERTY_ISO4217_CURRENCY_CODE_FILE to locate the source of the enumeration.

See Also:
Serialized Form

Constructor Summary
ISO4217CurrencyAmountValidator()
          Creates a new instance.
 
Method Summary
static String[] getCurrencyCodes()
          Getter method which returns an array of all currently legal SWIFT currency codes.
static int[] getCurrencyData()
          Getter method which returns an array containing the default fraction digits allowed by SWIFT for each currency.
static String[] getCurrencyNames()
          Getter method which returns an array containing all currently legal SWIFT currency names.
static int getDefaultFractionDigits(String currency)
          Returns the default fraction digits allowed for a given currency.
static void init()
          Reinitializes the validator from the system property.
 boolean validate(Object object, DataComponent component, ComplexDataObject context, ValidationManager manager)
          Validate the given object.
 
Methods inherited from class biz.c24.io.api.data.DefaultValidationRule
addDependentPredicateCode, getAnnotation, getContextForPredicateChecking, getDependentPredicateCode, getDependentPredicateCodeCount, getErrorCode, getName, getPredicateCode, getSeverity, removeDependentPredicateCode, setAnnotation, setErrorCode, setName, setPredicateCode, setSeverity, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ISO4217CurrencyAmountValidator

public ISO4217CurrencyAmountValidator()
Creates a new instance.

Method Detail

init

public static void init()
Reinitializes the validator from the system property.

Use this method if you change the system property setting during the invocation of the JVM.


getCurrencyCodes

public static String[] getCurrencyCodes()
Getter method which returns an array of all currently legal SWIFT currency codes.

Returns:
The arrays.

getCurrencyNames

public static String[] getCurrencyNames()
Getter method which returns an array containing all currently legal SWIFT currency names.

Returns:
The array.

getCurrencyData

public static int[] getCurrencyData()
Getter method which returns an array containing the default fraction digits allowed by SWIFT for each currency.

Returns:
The array.

getDefaultFractionDigits

public static int getDefaultFractionDigits(String currency)
Returns the default fraction digits allowed for a given currency.

Parameters:
currency - The String currency code representing a currency.
Returns:
int The integer number of default fraction digits allowed for the given currency.

validate

public boolean validate(Object object,
                        DataComponent component,
                        ComplexDataObject context,
                        ValidationManager manager)
                 throws ValidationException
Description copied from interface: Validator
Validate the given object.

Specified by:
validate in interface Validator
Overrides:
validate in class DefaultValidationRule
Parameters:
object - The object to be validated - commonly a String, Integer, Double, Date etc.
component - The Element or Attribute inside context which defines object.
context - The parent of object - could be null.
manager - The validation manager which is performing this validation.
Returns:
Whether the object is valid if the validation manager is not operating in exception mode.
Throws:
ValidationException - If the object is not valid and the validation maanger is operating in exception mode.


C24 Technologies © 2002-2012: All Rights Reserved.