|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jminor.common.model.valuemap.DefaultValueMapValidator<String,Object>
org.jminor.framework.domain.Entities.Validator
public static class Entities.Validator
A default extensible Entity.Validator implementation.
Field Summary |
---|
Fields inherited from interface org.jminor.common.model.valuemap.ValueMapValidator |
---|
INSERT, UNKNOWN, UPDATE |
Constructor Summary | |
---|---|
Entities.Validator(String entityID)
Instantiates a new EntityValidator |
Method Summary | |
---|---|
String |
getEntityID()
|
boolean |
isNullable(ValueMap<String,Object> valueMap,
String key)
Returns true if the given property accepts a null value for the given entity, by default this method simply returns property.isNullable() |
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 |
void |
validate(ValueMap<String,Object> valueMap,
int action)
Checks if the values in the given value map are valid |
void |
validate(ValueMap<String,Object> valueMap,
String key,
int action)
Checks if the value associated with the give key is valid, throws a ValidationException if not |
Methods inherited from class org.jminor.common.model.valuemap.DefaultValueMapValidator |
---|
isValid |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.jminor.common.model.valuemap.ValueMapValidator |
---|
isValid |
Constructor Detail |
---|
public Entities.Validator(String entityID)
entityID
- the ID of the entities to validateMethod Detail |
---|
public final String getEntityID()
getEntityID
in interface Entity.Validator
public boolean isNullable(ValueMap<String,Object> valueMap, String key)
property.isNullable()
isNullable
in interface ValueMapValidator<String,Object>
isNullable
in class DefaultValueMapValidator<String,Object>
valueMap
- the entity being validatedkey
- the property ID
public void validate(Entity entity, int action) throws ValidationException
validate
in interface Entity.Validator
entity
- the entity to validateaction
- the action requiring validation
ValidationException
- in case the validation failsProperty.setNullable(boolean)
,
Configuration.PERFORM_NULL_VALIDATION
public final void validate(Collection<Entity> entities, int action) throws ValidationException
validate
in interface Entity.Validator
entities
- the entities to validateaction
- describes the action requiring validation,
EntityEditor.INSERT, EntityEditor.UPDATE or EntityEditor.UNKNOWN
ValidationException
- in case the validation failspublic final void validate(ValueMap<String,Object> valueMap, int action) throws ValidationException
validate
in interface ValueMapValidator<String,Object>
validate
in class DefaultValueMapValidator<String,Object>
valueMap
- the value mapaction
- the action requiring validation
ValidationException
- in case of an invalid valuepublic final void validate(ValueMap<String,Object> valueMap, String key, int action) throws ValidationException
validate
in interface ValueMapValidator<String,Object>
validate
in class DefaultValueMapValidator<String,Object>
valueMap
- the value map to validatekey
- the key the value is associated withaction
- describes the action requiring validation,
ValueChangeMapEditModel.INSERT, ValueChangeMapEditModel.UPDATE or ValueChangeMapEditModel.UNKNOWN
ValidationException
- if the given value is not valid for the given keypublic void validate(Entity entity, String propertyID, int action) throws ValidationException
validate
in interface Entity.Validator
entity
- the entity to validatepropertyID
- the ID of the property to validateaction
- the action requiring validation
ValidationException
- in case the validation failsProperty.setNullable(boolean)
,
Configuration.PERFORM_NULL_VALIDATION
public final void performRangeValidation(Entity entity, Property property) throws RangeValidationException
performRangeValidation
in interface Entity.Validator
entity
- the entityproperty
- the property
RangeValidationException
- in case the value of the given property is outside the legal rangeProperty.setMax(double)
,
Property.setMin(double)
public final void performNullValidation(Entity entity, Property property, int action) throws NullValidationException
performNullValidation
in interface Entity.Validator
entity
- the entityproperty
- the propertyaction
- the action requiring validation
NullValidationException
- in case the proerty value is null and the property is not nullableProperty.isNullable()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |