Constructor and Description |
---|
JAXBValidator(XMLValidator newValidator)
This constructor creates a
DefaultValidationEventHandlervalidation instance, and sets the
XMLMarshaller instance to the one provided.
|
Modifier and Type | Method and Description |
---|---|
ValidationEventHandler |
getEventHandler()
Return the current event handler or the default event handler if one
hasn't been set.
|
java.lang.Object |
getProperty(java.lang.String key)
Get the particular property in the underlying implementation of
Validator.
|
void |
setEventHandler(ValidationEventHandler newValidationEventHandler)
Allow an application to register a validation event handler.
|
void |
setProperty(java.lang.String key,
java.lang.Object value)
Set the particular property in the underlying implementation of
Validator.
|
boolean |
validate(java.lang.Object object)
Validate a non-root object against a schema.
|
boolean |
validateRoot(java.lang.Object rootObject)
Validate a root object against a schema.
|
public JAXBValidator(XMLValidator newValidator)
newXMLMarshaller
- public boolean validateRoot(java.lang.Object rootObject) throws JAXBException
validateRoot
in interface Validator
rootObject
- - the root object to be validatedJAXBException
ValidationException
- If the ValidationEventHandler
returns false from its handleEvent method or the
Validator is unable to validate the content tree rooted
at rootObjpublic boolean validate(java.lang.Object object) throws JAXBException
validate
in interface Validator
object
- - the object to be validatedJAXBException
ValidationException
- If the ValidationEventHandler
returns false from its handleEvent method or the
Validator is unable to validate the content tree rooted
at subrootObjpublic void setEventHandler(ValidationEventHandler newValidationEventHandler) throws JAXBException
Validator
The validation event handler will be called by the JAXB Provider if any
validation errors are encountered during calls to
validate
. If the client application does not
register a validation event handler before invoking the validate method,
then validation events will be handled by the default event handler which
will terminate the validate operation after the first error or fatal error
is encountered.
Calling this method with a null parameter will cause the Validator to revert back to the default default event handler.
setEventHandler
in interface Validator
newValidationEventHandler
- the validation event handlerJAXBException
- if an error was encountered while setting the
event handlerpublic ValidationEventHandler getEventHandler() throws JAXBException
Validator
getEventHandler
in interface Validator
JAXBException
- if an error was encountered while getting the
current event handlerpublic void setProperty(java.lang.String key, java.lang.Object value) throws PropertyException
Validator
setProperty
in interface Validator
key
- the name of the property to be set. This value can either
be specified using one of the constant fields or a user
supplied string.value
- the value of the property to be setPropertyException
- when there is an error processing the given
property or valuepublic java.lang.Object getProperty(java.lang.String key) throws PropertyException
Validator
getProperty
in interface Validator
key
- the name of the property to retrievePropertyException
- when there is an error retrieving the given property or value
property name