de.smartics.properties.api.core.domain
Interface PropertyConstraint<T>

Package class diagram package PropertyConstraint
Type Parameters:
T - the type of the property value.
All Superinterfaces:
Serializable
All Known Implementing Classes:
AbstractPropertyConstraint, GenericPropertyConstraint, ListValueConstraint, PropertyRangeConstraint

public interface PropertyConstraint<T>
     
     
extends Serializable

Defines constraints on a property value and a description to the constraint that can be presented to the user.


Method Summary
 String getDescription()
          Returns a description of the defined constraints.
 String getDescription(Locale locale)
          Returns a localized description of the defined constraints.
 boolean isMandatoryConstraint()
          Determines if the constraint is a check that evaluates if a property is present or not and fails if a value is not present.
 boolean isValid(T value)
          Checks if the given value is valid.
 void validate(PropertyDescriptor propertyKey, T value)
          Checks if the given value is valid.
 

Method Detail

isMandatoryConstraint

boolean isMandatoryConstraint()
Determines if the constraint is a check that evaluates if a property is present or not and fails if a value is not present.

Returns:
true if the constraint is a check for value presence, false if it is any regular constraint.

getDescription

String getDescription(Locale locale)
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.

getDescription

String getDescription()
Returns a description of the defined constraints.

This is not the validation message that is displayed if the validation fails. This is a description of the constraints on a value that must be met to pass the validation process successfully. The description may be displayed to a user prior to request the input of a value.

Returns:
a description of the defined constraints.

isValid

boolean isValid(T value)
Checks if the given value is valid.

Parameters:
value - the value to be checked.
Returns:
true if the value is valid, false otherwise.

validate

void validate(PropertyDescriptor propertyKey,
              T value)
              throws PropertyValidationException
Checks if the given value is valid.

Parameters:
propertyKey - information about the name of the property to validate.
value - the value to be checked.
Throws:
PropertyValidationException - if the value is not valid.


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