org.jminor.framework.domain
Interface Entity.Validator

All Superinterfaces:
ValueMapValidator<String,Object>
All Known Implementing Classes:
Entities.Validator
Enclosing interface:
Entity

public static interface Entity.Validator
extends ValueMapValidator<String,Object>

Responsible for providing validation for entities.


Field Summary
 
Fields inherited from interface org.jminor.common.model.valuemap.ValueMapValidator
INSERT, UNKNOWN, UPDATE
 
Method Summary
 String getEntityID()
           
 void performNullValidation(Entity entity, Property property, int action)
          Performs a null validation on the given property
 void performRangeValidation(Entity entity, Property property)
          Performs a range validation on the given property
 void validate(Collection<Entity> entities, int action)
          Validates the given Entity objects.
 void validate(Entity entity, int action)
          Validates the values in the given entity
 void validate(Entity entity, String propertyID, int action)
          Validates the given property in the given entity
 
Methods inherited from interface org.jminor.common.model.valuemap.ValueMapValidator
isNullable, isValid, validate, validate
 

Method Detail

getEntityID

String getEntityID()
Returns:
the ID of the entity this validator validates

validate

void validate(Entity entity,
              int action)
              throws ValidationException
Validates the values in the given entity

Parameters:
entity - the entity to validate
action - the action requiring validation
Throws:
ValidationException - in case the validation fails
See Also:
Property.setNullable(boolean), Configuration.PERFORM_NULL_VALIDATION

validate

void validate(Entity entity,
              String propertyID,
              int action)
              throws ValidationException
Validates the given property in the given entity

Parameters:
entity - the entity to validate
propertyID - the ID of the property to validate
action - the action requiring validation
Throws:
ValidationException - in case the validation fails
See Also:
Property.setNullable(boolean), Configuration.PERFORM_NULL_VALIDATION

validate

void validate(Collection<Entity> entities,
              int action)
              throws ValidationException
Validates the given Entity objects.

Parameters:
entities - the entities to validate
action - describes the action requiring validation, EntityEditor.INSERT, EntityEditor.UPDATE or EntityEditor.UNKNOWN
Throws:
ValidationException - in case the validation fails

performNullValidation

void performNullValidation(Entity entity,
                           Property property,
                           int action)
                           throws NullValidationException
Performs a null validation on the given property

Parameters:
entity - the entity
property - the property
action - the action requiring validation
Throws:
NullValidationException - in case the proerty value is null and the property is not nullable
See Also:
Property.isNullable()

performRangeValidation

void performRangeValidation(Entity entity,
                            Property property)
                            throws RangeValidationException
Performs a range validation on the given property

Parameters:
entity - the entity
property - the property
Throws:
RangeValidationException - in case the value of the given property is outside the legal range
See Also:
Property.setMax(double), Property.setMin(double)