org.norther.tammi.spray.ui.util
Class SearchBoxValidator

java.lang.Object
  extended by org.norther.tammi.spray.ui.util.SearchBoxValidator
All Implemented Interfaces:
Serializable, AttributeValidator

public class SearchBoxValidator
extends Object
implements AttributeValidator, Serializable

Validates search patterns.

Author:
Ilkka Priha
See Also:
Serialized Form

Constructor Summary
SearchBoxValidator()
          Constructs a new validator.
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchBoxValidator

public SearchBoxValidator()
Constructs a new validator.

Method Detail

validateValue

public Object validateValue(Variable var,
                            String attributeName,
                            Object attributeValue,
                            Map modifiedAttributes)
                     throws InvalidAttributeValueException
Description copied from interface: AttributeValidator
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.

Specified by:
validateValue in interface AttributeValidator
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

public void validateValues(Variable var,
                           Map modifiedAttributes)
                    throws AttributeNotFoundException,
                           InvalidAttributeValueException
Description copied from interface: AttributeValidator
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.

Specified by:
validateValues in interface AttributeValidator
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.