biz.c24.io.api.data
Class ISO3166CountryValidationRule

java.lang.Object
  extended by biz.c24.io.api.data.DefaultValidationRule
      extended by biz.c24.io.api.data.ISO3166CountryValidationRule
All Implemented Interfaces:
ModelComponent, ValidationRule, Validator, Serializable

public class ISO3166CountryValidationRule
extends DefaultValidationRule

author: Matteo De Luise

See Also:
Serialized Form

Constructor Summary
ISO3166CountryValidationRule()
           
 
Method Summary
 Annotation getAnnotation()
          Returns the annotation associated with this rule.
 Annotation getAnnotation(int index)
           
 int getCount()
           
static String[] getCountryCodes()
          Getter method for the array of country codes.
static String[] getCountryNames()
          Getter method for the array of country names.
 String getErrorCode()
          Returns the error code associated with this rule.
 int getIndex(String value)
           
 String getName()
          Returns the name of this component.
 String getName(int index)
           
 String getValue(int index)
           
static void init()
          Reinitializes the validator from the system property.
 boolean validate(Object object, DataComponent component, ComplexDataObject context, ValidationManager manager)
          Validate the given object.
 boolean validateString(String countryCode)
           
 
Methods inherited from class biz.c24.io.api.data.DefaultValidationRule
addDependentPredicateCode, getContextForPredicateChecking, getDependentPredicateCode, getDependentPredicateCodeCount, 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

ISO3166CountryValidationRule

public ISO3166CountryValidationRule()
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.


getCountryCodes

public static String[] getCountryCodes()
Getter method for the array of country codes.

Returns:
The array.

getIndex

public int getIndex(String value)

getCountryNames

public static String[] getCountryNames()
Getter method for the array of country names.

Returns:
The array.

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.

validateString

public boolean validateString(String countryCode)

getValue

public String getValue(int index)

getName

public String getName(int index)

getAnnotation

public Annotation getAnnotation(int index)

getCount

public int getCount()

getAnnotation

public Annotation getAnnotation()
Description copied from interface: ValidationRule
Returns the annotation associated with this rule.

Specified by:
getAnnotation in interface ValidationRule
Overrides:
getAnnotation in class DefaultValidationRule
Returns:
The annotation

getName

public String getName()
Description copied from interface: ModelComponent
Returns the name of this component.

Specified by:
getName in interface ModelComponent
Overrides:
getName in class DefaultValidationRule
Returns:
The name.

getErrorCode

public String getErrorCode()
Description copied from interface: ValidationRule
Returns the error code associated with this rule.

Specified by:
getErrorCode in interface ValidationRule
Overrides:
getErrorCode in class DefaultValidationRule
Returns:
The error code.


C24 Technologies © 2002-2012: All Rights Reserved.