javax.xml.bind.util
public class: ValidationEventCollector [javadoc |
source]
java.lang.Object
javax.xml.bind.util.ValidationEventCollector
All Implemented Interfaces:
ValidationEventHandler
ValidationEventHandler
implementation that collects all events.
To use this class, create a new instance and pass it to the setEventHandler
method of the Validator, Unmarshaller, Marshaller class. After the call to
validate or unmarshal completes, call the getEvents method to retrieve all
the reported errors and warnings.
version: $
- Revision: 1.3 $
since: JAXB1.0
-
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from javax.xml.bind.util.ValidationEventCollector Detail: |
public ValidationEvent[] getEvents() {
return events.toArray(new ValidationEvent[events.size()]);
}
Return an array of ValidationEvent objects containing a copy of each of
the collected errors and warnings. |
public boolean handleEvent(ValidationEvent event) {
events.add(event);
boolean retVal = true;
switch( event.getSeverity() ) {
case ValidationEvent.WARNING:
retVal = true; // continue validation
break;
case ValidationEvent.ERROR:
retVal = true; // continue validation
break;
case ValidationEvent.FATAL_ERROR:
retVal = false; // halt validation
break;
default:
_assert( false,
Messages.format( Messages.UNRECOGNIZED_SEVERITY,
event.getSeverity() ) );
break;
}
return retVal;
}
|
public boolean hasEvents() {
return !events.isEmpty();
}
Returns true if this event collector contains at least one
ValidationEvent. |
public void reset() {
events.clear();
}
Clear all collected errors and warnings. |