org.apache.beehive.controls.runtime.bean
Class AnnotationConstraintValidator
Object
AnnotationConstraintValidator
- Direct Known Subclasses:
- AnnotationConstraintAptValidator
public class AnnotationConstraintValidator
- extends Object
This class offers methods for validating values assigned to a control property.
The validation process will ensure
1. The value is appropriate for the property's property type
2. The value satisfies the constraints defined on the property type
3. The value satisfies the constraints defined on the property set that the property is defined in.
Refer to AnnotationMemberTypes
and
AnnotationConstraints
for more
information on property constraints.
Method Summary |
static Date |
parseDate(String format,
String value)
|
protected static void |
validate(Annotation[] annotations,
Object value)
|
static void |
validate(PropertyKey key,
Object value)
This method ensures that any control property value assignment satisfies
all property constraints. |
static void |
validateMembership(Annotation propertySet)
This method ensures the membership constraints defined on a property set
is satisfied. |
Methods inherited from class Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AnnotationConstraintValidator
public AnnotationConstraintValidator()
validate
public static void validate(PropertyKey key,
Object value)
throws IllegalArgumentException
- This method ensures that any control property value assignment satisfies
all property constraints. This method should be called by control
property setters to ensure values assigned to properties at runtime are
validated.
- Parameters:
key
- The property that the specified key is assigned tovalue
- The value assigned to the specified property key
- Throws:
IllegalArgumentException
- when the value assigned to the specified property key does
not satisfy a property constraint.
validateMembership
public static void validateMembership(Annotation propertySet)
- This method ensures the membership constraints defined on a property set
is satisfied.
- Parameters:
propertySet
- the property set to validate
validate
protected static void validate(Annotation[] annotations,
Object value)
throws IllegalArgumentException
- Throws:
IllegalArgumentException
parseDate
public static Date parseDate(String format,
String value)
throws ParseException
- Throws:
ParseException