JAXB
v0.21

javax.xml.bind
Class ValidatableObject

java.lang.Object
  |
  +--javax.xml.bind.ValidatableObject
Direct Known Subclasses:
MarshallableObject

public abstract class ValidatableObject
extends Object

Abstract base class for all validatable objects. The methods in this class, in conjunction with those in the Validator class, define the content-tree validation process.

Version:
1.8, 01/05/31
See Also:
Validator

Method Summary
 void invalidate()
          Marks this object invalid.
 void validate()
          Validates the content tree rooted at this object, which must be a root element.
 void validate(Validator vd)
          Recursively validates this object's children using the given validator and updates the validator with any local information that is subject to global constraints.
 void validateThis()
          Ensures that this object does not violate any local structural constraints.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

invalidate

public final void invalidate()
Marks this object invalid. An invalid object will be revalidated the next time its content tree is validated. An invalid object will also prevent its content tree from being marshalled.

This method is intended to be invoked only by the property-mutation methods defined in schema-derived classes. It should not be invoked during the unmarshalling process.


validate

public final void validate()
                    throws StructureValidationException
Validates the content tree rooted at this object, which must be a root element.

This method creates a new Validator object and then proceeds to validate this content tree by invoking the validator's validate(ValidatableObject) method, passing this object. If this recursive process completes successfully then the validation propositions are known to hold for every object in the content tree. This method then checks that the target of every identifier reference has an identifier and is a member of the content tree.

Throws:
StructureValidationException - If any structural constraints are violated
UnsupportedOperationException - If this object is not an instance of the RootElement interface

validate

public void validate(Validator vd)
              throws StructureValidationException
Recursively validates this object's children using the given validator and updates the validator with any local information that is subject to global constraints.

This method must invoke the validator's validate(ValidatableObject) method upon the children of this object in the content tree. It must also invoke the validator's reference(IdentifiableElement) method upon the target of each identifier-reference property in this object.

The default implementation of this method does nothing; it should be overridden only by schema-derived classes. This method may only be invoked by the validation process; its behavior when invoked in any other manner is unspecified.

Parameters:
vd - The validator to be applied to this object's children
Throws:
StructureValidationException - If any structural constraints are violated

validateThis

public void validateThis()
                  throws LocalValidationException
Ensures that this object does not violate any local structural constraints. In particular, this method ensures that any required properties have been given values and that the object's children in the content tree, if any, match the content specification of the schema component from which this object's class was derived. This method does not recursively validate this object's children.

The default implementation of this method does nothing; it should be overridden only by schema-derived classes. This method may be invoked outside of the normal validation process.

Throws:
EmptyAttributeException - If a collection property derived from a compound attribute is empty, but the source schema requires at least one value
InvalidContentException - If the children of this object violate the content specification of the schema component from which this object's class was derived
MissingAttributeException - If a property derived from a required attribute has no value
MissingContentException - If a property derived from a required content component has no value

JAXB
v0.21


Comments to: jaxb-comments@java.sun.com
More information at: http://java.sun.com/xml/jaxb

Copyright © 2001 by Sun Microsystems, Inc., 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.