com.cafesoft.core.data
Class StandardValidatorMap

java.lang.Object
  extended by com.cafesoft.core.data.StandardValidatorMap
All Implemented Interfaces:
ValidatorMap

public class StandardValidatorMap
extends Object
implements ValidatorMap

StandardValidatorMap implements a ValidatorMap, which associates a key with a Validator instance suitable for validating a value assigned to the specified key.

Since:
12/28/2006

Constructor Summary
StandardValidatorMap(int size, boolean caseSensitiveKeys)
          Create a new StandardValidatorMap instance.
 
Method Summary
 void add(String key, Validator validator)
          Add a Validator for the specified key.
 boolean containsKey(String key)
          Returns true if the ValidtorMap contains the specified key.
 void destroy()
          Destroy the ValidatorMap.
 String toString()
          Return a String representation of the StandardValidatorMap.
 boolean validate(String key, Object value, boolean validIfNoValidator)
          Validate the value associated with a given key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StandardValidatorMap

public StandardValidatorMap(int size,
                            boolean caseSensitiveKeys)
Create a new StandardValidatorMap instance.

Parameters:
size - the initial size of the Map.
caseSensitiveKeys - flag indicating whether keys are case sensitive (true) or not (false)
Method Detail

add

public void add(String key,
                Validator validator)
Add a Validator for the specified key.

Specified by:
add in interface ValidatorMap
Parameters:
key - the key.
validator - the Validator.

validate

public boolean validate(String key,
                        Object value,
                        boolean validIfNoValidator)
Validate the value associated with a given key.

Specified by:
validate in interface ValidatorMap
Parameters:
key - the key associated with the value to be validated.
value - the value to be validated.
validIfNoValidator - a boolean value indicating whether validation should succeed if no validator is defined for a the specified key. If true and a Validator is not associated with the key, then return true.
Returns:
true if the value is valid or false if it is not.

containsKey

public boolean containsKey(String key)
Returns true if the ValidtorMap contains the specified key.

Specified by:
containsKey in interface ValidatorMap
Parameters:
key - the key.
Returns:
true if the ValidatorMap contains the specified key, else false.

destroy

public void destroy()
Destroy the ValidatorMap.

Specified by:
destroy in interface ValidatorMap

toString

public String toString()
Return a String representation of the StandardValidatorMap.

Overrides:
toString in class Object
Returns:
a String representation of the StandardValidatorMap.


Generated on 10:38:35 AM April 14, 2011, © 1996-2010 Cafésoft LLC. All rights reserved.