src/share/jaxws_classes/javax/xml/bind/helpers/DefaultValidationEventHandler.java

Print this page
rev 507 : 8047724: @since tag cleanup in jaxws
Reviewed-by:


  35 /**
  36  * <p>
  37  * JAXB 1.0 only default validation event handler. This is the default
  38  * handler for all objects created from a JAXBContext that is managing
  39  * schema-derived code generated by a JAXB 1.0 binding compiler.
  40  *
  41  * <p>
  42  * This handler causes the unmarshal and validate operations to fail on the first
  43  * error or fatal error.
  44  *
  45  * <p>
  46  * This handler is not the default handler for JAXB mapped classes following
  47  * JAXB 2.0 or later versions. Default validation event handling has changed
  48  * and is specified in  {@link javax.xml.bind.Unmarshaller} and
  49  * {@link javax.xml.bind.Marshaller}.
  50  *
  51  * @author <ul><li>Ryan Shoemaker, Sun Microsystems, Inc.</li></ul>
  52  * @see javax.xml.bind.Unmarshaller
  53  * @see javax.xml.bind.Validator
  54  * @see javax.xml.bind.ValidationEventHandler
  55  * @since JAXB1.0
  56  */
  57 public class DefaultValidationEventHandler implements ValidationEventHandler {
  58 
  59     public boolean handleEvent( ValidationEvent event ) {
  60 
  61         if( event == null ) {
  62             throw new IllegalArgumentException();
  63         }
  64 
  65         // calculate the severity prefix and return value
  66         String severity = null;
  67         boolean retVal = false;
  68         switch ( event.getSeverity() ) {
  69             case ValidationEvent.WARNING:
  70                 severity = Messages.format( Messages.WARNING );
  71                 retVal = true; // continue after warnings
  72                 break;
  73             case ValidationEvent.ERROR:
  74                 severity = Messages.format( Messages.ERROR );
  75                 retVal = false; // terminate after errors




  35 /**
  36  * <p>
  37  * JAXB 1.0 only default validation event handler. This is the default
  38  * handler for all objects created from a JAXBContext that is managing
  39  * schema-derived code generated by a JAXB 1.0 binding compiler.
  40  *
  41  * <p>
  42  * This handler causes the unmarshal and validate operations to fail on the first
  43  * error or fatal error.
  44  *
  45  * <p>
  46  * This handler is not the default handler for JAXB mapped classes following
  47  * JAXB 2.0 or later versions. Default validation event handling has changed
  48  * and is specified in  {@link javax.xml.bind.Unmarshaller} and
  49  * {@link javax.xml.bind.Marshaller}.
  50  *
  51  * @author <ul><li>Ryan Shoemaker, Sun Microsystems, Inc.</li></ul>
  52  * @see javax.xml.bind.Unmarshaller
  53  * @see javax.xml.bind.Validator
  54  * @see javax.xml.bind.ValidationEventHandler
  55  * @since 1.6, JAXB 1.0
  56  */
  57 public class DefaultValidationEventHandler implements ValidationEventHandler {
  58 
  59     public boolean handleEvent( ValidationEvent event ) {
  60 
  61         if( event == null ) {
  62             throw new IllegalArgumentException();
  63         }
  64 
  65         // calculate the severity prefix and return value
  66         String severity = null;
  67         boolean retVal = false;
  68         switch ( event.getSeverity() ) {
  69             case ValidationEvent.WARNING:
  70                 severity = Messages.format( Messages.WARNING );
  71                 retVal = true; // continue after warnings
  72                 break;
  73             case ValidationEvent.ERROR:
  74                 severity = Messages.format( Messages.ERROR );
  75                 retVal = false; // terminate after errors