com.iparelan.util.beans
Class BeanTools.NonNullPropertyChangeEventValidator

java.lang.Object
  extended by com.iparelan.util.UtilObject
      extended by com.iparelan.util.validation.AbstractValidationStrategy<T>
          extended by com.iparelan.util.validation.NonNullValidationStrategy<PropertyChangeEvent>
              extended by 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.


Nested Class Summary
static class BeanTools.NonNullPropertyChangeEventValidator.ContextIndex
          Indices of contextual information in the context argument of validate(java.beans.PropertyChangeEvent, java.lang.Object...).
 
Field Summary
 
Fields inherited from class com.iparelan.util.validation.AbstractValidationStrategy
valueDescription
 
Fields inherited from class com.iparelan.util.UtilObject
LOGGER, MSGS, UTILITIES_LOGGER_NAME
 
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
 
Constructor Summary
BeanTools.NonNullPropertyChangeEventValidator()
          Creates a new NonNullPropertyChangeEventValidator
 
Method Summary
 void validate(PropertyChangeEvent evt, Object... context)
          Validates the specified value.
 
Methods inherited from class com.iparelan.util.validation.NonNullValidationStrategy
getValidatorDescription
 
Methods inherited from class com.iparelan.util.validation.AbstractValidationStrategy
getValueDescription, getValueDescription, toString, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BeanTools.NonNullPropertyChangeEventValidator

public BeanTools.NonNullPropertyChangeEventValidator()
Creates a new NonNullPropertyChangeEventValidator

Method Detail

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]:

  1. valueDescription

    The conventional value description.

  2. expectedSourceBean

    The JavaBean that is the expected source of the PropertyChangeEvent.

  3. expectedPropertyName

    The property expected to be described by the PropertyChangeEvent.

  4. expectedValueType

    The expected type of the new property value.

  5. 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.