de.smartics.properties.spi.config.validation
Class ConfigurationValidator

Package class diagram package ConfigurationValidator
java.lang.Object
  extended by de.smartics.properties.spi.config.validation.ConfigurationValidator
All Implemented Interfaces:
Serializable

public final class ConfigurationValidator
     
     
extends Object
implements Serializable

Helper to validate sets of properties. Helpful for ConfigurationProperties.

See Also:
Serialized Form

Constructor Summary
ConfigurationValidator(ConfigurationPropertiesManagement configuration)
          Default constructor for non-lenient validation.
ConfigurationValidator(ConfigurationPropertiesManagement configuration, boolean lenient)
          Default constructor.
 
Method Summary
 void validate(PropertyCollection properties, Class<?>... groups)
          Validates the given properties.
 void validate(PropertyDescriptor descriptor, Object value, Class<?>... groups)
          Validates the given value for the given descriptor and groups.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurationValidator

public ConfigurationValidator(ConfigurationPropertiesManagement configuration)
Default constructor for non-lenient validation.

Parameters:
configuration - the configuration to validate.

ConfigurationValidator

public ConfigurationValidator(ConfigurationPropertiesManagement configuration,
                              boolean lenient)
Default constructor.

Parameters:
configuration - the configuration to validate.
lenient - the lenient flag that tells the validation process to handle unknown properties gracefully if set to true.
Method Detail

validate

public void validate(PropertyCollection properties,
                     Class<?>... groups)
              throws de.smartics.util.lang.NullArgumentException,
                     ConfigurationValidationException
Validates the given properties.

Parameters:
properties - the properties to validate.
Throws:
de.smartics.util.lang.NullArgumentException - if properties is null.
ConfigurationValidationException - if validation fails.

validate

public void validate(PropertyDescriptor descriptor,
                     Object value,
                     Class<?>... groups)
Validates the given value for the given descriptor and groups.

Parameters:
descriptor - the descriptor to determine the constraints to check.
value - the value to check.
groups - the constraint groups to consider. If empty or null only the constraints in the default are checked.


Copyright © 2012-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.