de.smartics.properties.spi.core.constraints
Class PropertyRangeConstraint<T>

Package class diagram package PropertyRangeConstraint
java.lang.Object
  extended by de.smartics.properties.spi.core.constraint.AbstractPropertyConstraint<T>
      extended by de.smartics.properties.spi.core.constraints.PropertyRangeConstraint<T>
Type Parameters:
T - the type of the property value.
All Implemented Interfaces:
PropertyConstraint<T>, Serializable

public final class PropertyRangeConstraint<T>
     
     
extends AbstractPropertyConstraint<T>

Constraint that requires values to be part of an enumeration.

See Also:
Serialized Form

Constructor Summary
PropertyRangeConstraint(PropertyValueRange<T> valueRange)
          Default constructor.
 
Method Summary
 String getDescription(Locale locale)
          Returns a localized description of the defined constraints.
 PropertyValueRange<T> getValueRange()
          Returns the list of valid properties.
 boolean isValid(T value, Class<?> group)
          Checks if the given value is valid only if the constraint is in the given group.
 
Methods inherited from class de.smartics.properties.spi.core.constraint.AbstractPropertyConstraint
getDescription, getViolationMessage, isMandatoryConstraint, isValid, toString, validate, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertyRangeConstraint

public PropertyRangeConstraint(PropertyValueRange<T> valueRange)
Default constructor.

Parameters:
valueRange - the list of valid properties.
Method Detail

getValueRange

public PropertyValueRange<T> getValueRange()
Returns the list of valid properties.

A value of null tells that there is no range defined.

Returns:
the list of valid properties.

getDescription

public String getDescription(Locale locale)
Description copied from interface: PropertyConstraint
Returns a localized description of the defined constraints.

Parameters:
locale - the locale to use to fetch a localized description.
Returns:
a localized description of the defined constraints.

isValid

public boolean isValid(T value,
                       Class<?> group)
Description copied from interface: PropertyConstraint
Checks if the given value is valid only if the constraint is in the given group.

Parameters:
value - the value to be checked.
group - the validation only takes place if this constraint is in this group or the argument is null.
Returns:
true if the value is valid, false otherwise.


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