org.beanfabrics
Class ValidatableBean

java.lang.Object
  extended by org.beanfabrics.AbstractBean
      extended by org.beanfabrics.ValidatableBean
All Implemented Interfaces:
Bean, Validatable
Direct Known Subclasses:
AbstractPM

public class ValidatableBean
extends AbstractBean
implements Validatable

This is an implementation of Validatable that uses a Validator for producing a fresh ValidationState.


Constructor Summary
ValidatableBean()
          Constructs a new instance.
 
Method Summary
 ValidationState getValidationState()
          Returns the current validation state of this object.
 Validator getValidator()
          Returns the Validator of this object.
 boolean isValid()
          Returns whether this object is valid.
 void revalidate()
          Updates the validation state of this object, usually by calling Validator.validate().
protected  void setValidationState(ValidationState validationState)
          Replaces the validation state.
 
Methods inherited from class org.beanfabrics.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, equals, getPropertyChangeSupport, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidatableBean

public ValidatableBean()
Constructs a new instance.

Method Detail

revalidate

public void revalidate()
Updates the validation state of this object, usually by calling Validator.validate().

Specified by:
revalidate in interface Validatable

getValidationState

public final ValidationState getValidationState()
Returns the current validation state of this object.

Specified by:
getValidationState in interface Validatable
Returns:
the current validation state of this object

isValid

public final boolean isValid()
Returns whether this object is valid. This object is valid if its validation state is null.

Specified by:
isValid in interface Validatable
Returns:
true if this object is valid, otherwise false.

getValidator

public final Validator getValidator()
Returns the Validator of this object. The validator is responsible for creating the ValidationState of this object by evaluating a specific set of ValidationRules.

Specified by:
getValidator in interface Validatable
Returns:
the Validator of this object

setValidationState

protected final void setValidationState(ValidationState validationState)
Replaces the validation state. This method should not be called directly since it is called from the revalidate() method.