org.deduced.validation
Class ValidationUtilities

java.lang.Object
  extended by org.deduced.validation.ValidationUtilities

public class ValidationUtilities
extends java.lang.Object

Validation Utilities

Author:
Steve McDuff

Constructor Summary
ValidationUtilities()
           
 
Method Summary
private static PropertyCollection<?,?> createValidatorFromInstance(ModelFactory validatorFactory, PropertyCollection<?,?> controlledPropertyInstance)
          create Validator From Instance
static PropertyCollection<?,?> createValidatorFromValidationModel(ModelFactory validatorFactory, PropertyCollection<?,?> validationModel)
          create Validator From Validation Model
static PropertyCollection<?,?> createValidatorFromValidatorType(ModelFactory validatorFactory, PropertyCollection<?,?> validatorType)
          create Validator From Validator Type
private static void validateBasicType(java.lang.Object value, PropertyCollection<?,?> propertyInstanceInstanceType)
          validate Basic Type
private static void validateCollectionType(java.lang.Object value, PropertyCollection<?,?> controlledPropertyInstance, PropertyCollection<?,?> propertyInstanceInstanceType)
          validateCollectionType
private static void validateEnumerationType(java.lang.Object value, PropertyCollection<?,?> propertyInstanceInstanceType)
          validate Enumeration Type
static void validateNewValueOnInstance(java.lang.Object value, ModelFactory validatorFactory, PropertyCollection<?,?> controlledPropertyInstance, boolean validateParent)
          validate New Value On Instance
private static void validatePotentialListFixedInstance(PropertyCollection<?,?> controlledPropertyInstance, PropertyCollection<?,?> propertyInstanceInstanceType, PropertyCollection<?,?> collectionValue, PropertyCollection<?,?> valueType)
          validate a Potential List Fixed Instance
static void validateValueOnValidator(java.lang.Object value, PropertyCollection createdValidator)
          validate a Value On a Validator
private static void validateValueParentIfNotReference(java.lang.Object value, PropertyCollection<?,?> controlledPropertyInstance)
          validate Value Parent If Not Reference.
static void validateValueTypeOnInstance(java.lang.Object value, PropertyCollection<?,?> controlledPropertyInstance)
          validate that a value has the right type to match a property instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidationUtilities

public ValidationUtilities()
Method Detail

validateNewValueOnInstance

public static void validateNewValueOnInstance(java.lang.Object value,
                                              ModelFactory validatorFactory,
                                              PropertyCollection<?,?> controlledPropertyInstance,
                                              boolean validateParent)
validate New Value On Instance

Parameters:
value - the new value to validate
validatorFactory - the factory for validation
controlledPropertyInstance - the property instance to validate against
validateParent - option to validate the parent of the new value. If set to true, new values that are owned by value must have a null parent to be valid.
Throws:
java.lang.IllegalArgumentException - if validation fails

validateValueParentIfNotReference

private static void validateValueParentIfNotReference(java.lang.Object value,
                                                      PropertyCollection<?,?> controlledPropertyInstance)
validate Value Parent If Not Reference. This method will throw an exception if the new value has a non-null parent and the instance is by value.

Parameters:
value - the value to validate
controlledPropertyInstance - the property instance to use

validateValueTypeOnInstance

public static void validateValueTypeOnInstance(java.lang.Object value,
                                               PropertyCollection<?,?> controlledPropertyInstance)
validate that a value has the right type to match a property instance

Parameters:
value - the value to validate
controlledPropertyInstance - the property instance to validate against.

validateCollectionType

private static void validateCollectionType(java.lang.Object value,
                                           PropertyCollection<?,?> controlledPropertyInstance,
                                           PropertyCollection<?,?> propertyInstanceInstanceType)
validateCollectionType

Parameters:
value - the value to validate
controlledPropertyInstance - the property instance of the value
propertyInstanceInstanceType - the value type

validatePotentialListFixedInstance

private static void validatePotentialListFixedInstance(PropertyCollection<?,?> controlledPropertyInstance,
                                                       PropertyCollection<?,?> propertyInstanceInstanceType,
                                                       PropertyCollection<?,?> collectionValue,
                                                       PropertyCollection<?,?> valueType)
validate a Potential List Fixed Instance

Parameters:
controlledPropertyInstance - the property instance holding the value
propertyInstanceInstanceType - the type of the value
collectionValue - the value to validate
valueType - the value type

validateEnumerationType

private static void validateEnumerationType(java.lang.Object value,
                                            PropertyCollection<?,?> propertyInstanceInstanceType)
validate Enumeration Type

Parameters:
value - the value to validate
propertyInstanceInstanceType - the value type

validateBasicType

private static void validateBasicType(java.lang.Object value,
                                      PropertyCollection<?,?> propertyInstanceInstanceType)
validate Basic Type

Parameters:
value - the value to validate
propertyInstanceInstanceType - the type of the value

validateValueOnValidator

public static void validateValueOnValidator(java.lang.Object value,
                                            PropertyCollection createdValidator)
validate a Value On a Validator

Parameters:
value - the value to validate
createdValidator - the validator to use.
Throws:
java.lang.IllegalArgumentException - if validation fails

createValidatorFromInstance

private static PropertyCollection<?,?> createValidatorFromInstance(ModelFactory validatorFactory,
                                                                   PropertyCollection<?,?> controlledPropertyInstance)
create Validator From Instance

Parameters:
validatorFactory - the validator factory
controlledPropertyInstance - the instance to use to create the validator
Returns:
the created validator

createValidatorFromValidationModel

public static PropertyCollection<?,?> createValidatorFromValidationModel(ModelFactory validatorFactory,
                                                                         PropertyCollection<?,?> validationModel)
create Validator From Validation Model

Parameters:
validatorFactory - the validator factory
validationModel - the validation model
Returns:
the created validator

createValidatorFromValidatorType

public static PropertyCollection<?,?> createValidatorFromValidatorType(ModelFactory validatorFactory,
                                                                       PropertyCollection<?,?> validatorType)
create Validator From Validator Type

Parameters:
validatorFactory - the validator factory to use
validatorType - the validator type to create
Returns:
the created validator. Null if the operation failed or no validator type was specified.