nl.knowlogy.validation
Interface ClassValidator

All Known Implementing Classes:
ClassValidatorImpl

public interface ClassValidator

A ClassValidator is responsible for validation object's. It can validate objects of specific classes.

Therefore you can

Author:
Robert Hofstra, Knowlogy
See Also:
PropertyValidation

Method Summary
 void add(PropertyValidation propertyValidation)
           
 void addPropertyToGroups(String groupNames, String propertyName)
           
 Class getClazz()
          Returns clazz that can be validated by this validator.
 void validate(Object toValidate)
          Validates the object, if an error is signaled a Validation exception is thrown.
 void validate(Object toValidate, Messages messages)
          Validates the whole object.
 void validateGroup(Object toValidate, String groupName, Messages messages)
          Validates only the properties, which are contained in the group.
 void validateProperties(Object toValidate, List propertyNames, Messages messages)
          Validates only the properties, supplied in de propertyNames list, of the object toValidate.
 

Method Detail

getClazz

Class getClazz()
Returns clazz that can be validated by this validator. Subclasses of this class can also be validated by this class.

Returns:
class

add

void add(PropertyValidation propertyValidation)
Parameters:
propertyValidation -

addPropertyToGroups

void addPropertyToGroups(String groupNames,
                         String propertyName)
Parameters:
groupNames -
propertyName -

validate

void validate(Object toValidate)
Validates the object, if an error is signaled a Validation exception is thrown.

Parameters:
toValidate - object to validate

validate

void validate(Object toValidate,
              Messages messages)
Validates the whole object. In case of validation errors, validation messages are added to the messages.

Parameters:
toValidate - object to validate
messages - container to which validate messages are added.

validateGroup

void validateGroup(Object toValidate,
                   String groupName,
                   Messages messages)
Validates only the properties, which are contained in the group. This group is identified by groupname. In case of validation errors, validation messages are added to the messages.

Parameters:
toValidate - object which group is validated.
groupName - name of the group.
messages - container to which validate messages are added.

validateProperties

void validateProperties(Object toValidate,
                        List propertyNames,
                        Messages messages)
Validates only the properties, supplied in de propertyNames list, of the object toValidate. In case of validation errors, validation messages are added to the messages.

Parameters:
toValidate - object which properties are validated
propertyNames - List of names (String) of the properties which are validated
messages - container to which validate messages are added.


Copyright © 2007. All Rights Reserved.