javax.xml.bind
Interface Validator
- JMValidator
- JMValidatorImpl
public interface Validator
A
Validator
may be used to decide, whether
a JAXB object is valid or not. If it is not, the JAXB user
may decide to trigger an exception or not (via the
ValidationEventHandler
and he may
receive information on the problems location (via the
event handlers
ValidationEventLocator
.
A Validator may be present implicitly, invoked by the
Unmarshaller. See
Unmarshaller.setValidating(boolean)
for
more information on that.
ValidationEventHandler | getEventHandler() - Returns an event handler that shall be invoked for
notifications on problems detected by the
Validator .
|
java.lang.Object | getProperty(String pName) - Returns the marshallers property
pName .
|
void | setEventHandler(ValidationEventHandler pHandler) - Registers an event handler that shall be invoked for
notifications on problems detected by the
Validator .
|
void | setProperty(String pName, Object pValue) - Sets the
Validator property pName
to pValue .
|
boolean | validate(Object pObject) - Validates the given JAXB object, invoking its error handler
for any problems it detects.
|
boolean | validateRoot(Object pObject) - Validates the given JAXB object, but not its child
elements.
|
getEventHandler
public ValidationEventHandler getEventHandler()
throws JAXBException
Returns an event handler that shall be invoked for
notifications on problems detected by the Validator
.
If no specific event handler was set, returns the default
event handler. The default event handler will trigger an
exception for errors and fatal errors.
- The event handler previously set or the default
handler.
getProperty
public java.lang.Object getProperty(String pName)
throws PropertyException
Returns the marshallers property
pName
.
Note: The values type depends on the property name.
pName
- The property name.
setEventHandler
public void setEventHandler(ValidationEventHandler pHandler)
throws JAXBException
Registers an event handler that shall be invoked for
notifications on problems detected by the Validator
.
If this method is not invoked, there is a default event handler.
The default event handler will trigger an exception for
errors and fatal errors.
pHandler
- The event handler being notified or null
to restore the default event handler.
setProperty
public void setProperty(String pName,
Object pValue)
throws PropertyException
Sets the
Validator
property
pName
to
pValue
.
Note: The values type depends on the property name.
pName
- The property name.pValue
- The property value.
validate
public boolean validate(Object pObject)
throws JAXBException
pObject
- The JAXB object being validated.
validateRoot
public boolean validateRoot(Object pObject)
throws JAXBException
Validates the given JAXB object, but not its child
elements.
pObject
- The JAXB object being validated.