org.norther.tammi.core.rt.util
Interface AttributeValidator

All Known Implementing Classes:
AccountPasswordValidator, SearchBoxValidator

public interface AttributeValidator

An interface to a Variable attribute validator.

Author:
Marketta Priha

Method Summary
 Object validateValue(Variable var, String attributeName, Object attributeValue, Map modifiedAttributes)
          Validates the specified attribute value.
 void validateValues(Variable var, Map modifiedAttributes)
          Validates the attribute values in the specified map.
 

Method Detail

validateValue

Object validateValue(Variable var,
                     String attributeName,
                     Object attributeValue,
                     Map modifiedAttributes)
                     throws InvalidAttributeValueException
Validates the specified attribute value. This method is called in undefined order for each modified attribute within setAttribute, setAttributes and validateAttributes methods of Variable.

The variable contains always the current values of the attributes. The attribute map contains new values of related attributes that have been modified at the same time as the specified one. The map will be updated according to the validated value.

Parameters:
var - the variable owning the attribute.
attributeName - the name of the attribute.
attributeValue - the value to be validated.
modifiedAttributes - a read-only map of modified attributes.
Returns:
the validated value of the attribute.
Throws:
InvalidAttributeValueException - if the value is not valid.

validateValues

void validateValues(Variable var,
                    Map modifiedAttributes)
                    throws AttributeNotFoundException,
                           InvalidAttributeValueException
Validates the attribute values in the specified map. This method is called after validation of individual attribute values and before actually setting the values providing a possibility for the validator to cross-check the values and make final changes to them.

Note that it is also allowed to add new values to the map e.g. for dependent read-only attributes.

The method may throw InvalidAttributeValueException specifying the name of the invalid attribute as the message argument, or InvalidAttributeValuesException for for multiple attributes with any validation specific exception as the wrapped exception argument.

Parameters:
var - the variable owning the attributes.
modifiedAttributes - a map of modified attribute values.
Throws:
AttributeNotFoundException - for missing attributes.
InvalidAttributeValueException - if the values are not valid.


Copyright © 2004 The Norther Organization. All rights reserved.