org.jminor.common.model.valuemap
Interface ValueMapValidator<K,V>

All Known Subinterfaces:
Entity.Validator
All Known Implementing Classes:
DefaultValueMapValidator, Entities.Validator

public interface ValueMapValidator<K,V>

User: Björn Darri Date: 26.7.2010 Time: 22:19:14


Field Summary
static int INSERT
          Code for the insert action, used during validation
static int UNKNOWN
          Code for an unknown action, used during validation
static int UPDATE
          Code for the update action, used during validation
 
Method Summary
 boolean isNullable(ValueMap<K,V> valueMap, K key)
           
 boolean isValid(ValueMap<K,V> valueMap, int action)
           
 void validate(ValueMap<K,V> valueMap, int action)
          Checks if the values in the given value map are valid
 void validate(ValueMap<K,V> valueMap, K key, int action)
          Checks if the value associated with the give key is valid, throws a ValidationException if not
 

Field Detail

INSERT

static final int INSERT
Code for the insert action, used during validation

See Also:
Constant Field Values

UPDATE

static final int UPDATE
Code for the update action, used during validation

See Also:
Constant Field Values

UNKNOWN

static final int UNKNOWN
Code for an unknown action, used during validation

See Also:
Constant Field Values
Method Detail

isNullable

boolean isNullable(ValueMap<K,V> valueMap,
                   K key)
Parameters:
valueMap - the value map
key - the key
Returns:
true if this value is allowed to be null in the given value map

isValid

boolean isValid(ValueMap<K,V> valueMap,
                int action)
Parameters:
valueMap - the value map
action - the action requiring validation
Returns:
true if the given value map contains only valid values

validate

void validate(ValueMap<K,V> valueMap,
              int action)
              throws ValidationException
Checks if the values in the given value map are valid

Parameters:
valueMap - the value map
action - the action requiring validation
Throws:
ValidationException - in case of an invalid value

validate

void validate(ValueMap<K,V> valueMap,
              K key,
              int action)
              throws ValidationException
Checks if the value associated with the give key is valid, throws a ValidationException if not

Parameters:
valueMap - the value map to validate
key - the key the value is associated with
action - describes the action requiring validation, ValueChangeMapEditModel.INSERT, ValueChangeMapEditModel.UPDATE or ValueChangeMapEditModel.UNKNOWN
Throws:
ValidationException - if the given value is not valid for the given key