|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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
,
ValidationEvent
Method Summary | |
---|---|
ValidationEventHandler |
getEventHandler()
Returns an event handler that shall be invoked for notifications on problems detected by the Validator . |
java.lang.Object |
getProperty(java.lang.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(java.lang.String pName,
java.lang.Object pValue)
Sets the Validator property pName
to pValue . |
boolean |
validate(java.lang.Object pObject)
Validates the given JAXB object, invoking its error handler for any problems it detects. |
boolean |
validateRoot(java.lang.Object pObject)
Validates the given JAXB object, but not its child elements. |
Method Detail |
---|
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.
JAXBException
- Setting the event handler failed.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.
JAXBException
- Getting the event handler failed.boolean validate(java.lang.Object pObject) throws JAXBException
Validates the given JAXB object, invoking its error handler
for any problems it detects. Detected problems may cause exceptions,
for example, if the event handlers
ValidationEventHandler.handleEvent(ValidationEvent)
method returns false.
pObject
- The JAXB object being validated.
JAXBException
- An unexpected problem occurred during
validation
ValidationException
- It was detected, that the
object is invalid.
java.lang.IllegalArgumentException
- The parameter was null.validateRoot(Object)
boolean validateRoot(java.lang.Object pObject) throws JAXBException
Validates the given JAXB object, but not its child elements.
pObject
- The JAXB object being validated.
JAXBException
- An unexpected problem occurred during
validation
ValidationException
- It was detected, that the
object is invalid.
java.lang.IllegalArgumentException
- The parameter was null.validate(Object)
void setProperty(java.lang.String pName, java.lang.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.
PropertyException
- Setting the property failed.
java.lang.IllegalArgumentException
- The pName
parameter was null.java.lang.Object getProperty(java.lang.String pName) throws PropertyException
Returns the marshallers property pName
.
Note: The values type depends on the property name.
pName
- The property name.
PropertyException
- Fetching the property failed.
java.lang.IllegalArgumentException
- The parameter was null.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |