com.iparelan.util.beans
Class BeanTools.NonNullPropertyChangeEventValidator
java.lang.Object
com.iparelan.util.UtilObject
com.iparelan.util.validation.AbstractValidationStrategy<T>
com.iparelan.util.validation.NonNullValidationStrategy<PropertyChangeEvent>
com.iparelan.util.beans.BeanTools.NonNullPropertyChangeEventValidator
- All Implemented Interfaces:
- ValidationStrategy<PropertyChangeEvent>
- Enclosing class:
- BeanTools
public static final class BeanTools.NonNullPropertyChangeEventValidator
- extends NonNullValidationStrategy<PropertyChangeEvent>
A pre-defined validator for PropertyChangeEvents.
Ensures that a PropertyChangeEvent is from the
expect source and has the expected property of the expected type. Call
this validator whenever an event is received from a JavaBean.
| Fields inherited from interface com.iparelan.util.validation.ValidationStrategy |
BIG_DECIMAL_RANGE, BIG_INTEGER_RANGE, BYTE_RANGE, CALENDAR_RANGE, CHARACTER_RANGE, DATE_RANGE, DOUBLE_RANGE, FILE, FLOAT_RANGE, GREGORIAN_CALENDAR_RANGE, INTEGER, INTEGER_RANGE, LONG_RANGE, NON_EMPTY_STRING, NON_NULL_CLASS, NON_NULL_NON_EMPTY_STRING, NON_NULL_OBJECT, NON_NULL_STRING, SHORT_RANGE, SQL_DATE_RANGE, SQL_TIME_RANGE, SQL_TIMESTAMP_RANGE |
BeanTools.NonNullPropertyChangeEventValidator
public BeanTools.NonNullPropertyChangeEventValidator()
- Creates a new
NonNullPropertyChangeEventValidator
validate
public void validate(PropertyChangeEvent evt,
Object... context)
- Validates the specified value.
- Specified by:
validate in interface ValidationStrategy<PropertyChangeEvent>- Overrides:
validate in class NonNullValidationStrategy<PropertyChangeEvent>
- Parameters:
evt - The PropertyChangeEvent to be validated. May
not be null.context - The context must have the following organization or unvalidated cannot be validated:
[valueDescription : String, expectedSourceBean :
Object, expectedPropertyName : String, expectedValueType :
Class<?>, nullIsValid : Boolean]:
valueDescription
The conventional value description.
expectedSourceBean
The JavaBean that is the expected source of
the PropertyChangeEvent.
expectedPropertyName
The property expected to be described by the PropertyChangeEvent.
expectedValueType
The expected type of the
new
property value.
nullIsValidValue
true or false depending on whether
null is a valid value or not, respectively.
- Throws:
ValidationException - Iff the source of evt is not expectedSourceBean, or the property of the event is not
expectedPropertyName, or the type of the property
is not expectedValueType, or the new value of the
property is null and nullIsValidValue is
false.
Copyright © 2008 Iparelan Solutions, LLC. All rights reserved.