325N/A/*
325N/A * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
325N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
325N/A *
325N/A * This code is free software; you can redistribute it and/or modify it
325N/A * under the terms of the GNU General Public License version 2 only, as
325N/A * published by the Free Software Foundation. Oracle designates this
325N/A * particular file as subject to the "Classpath" exception as provided
325N/A * by Oracle in the LICENSE file that accompanied this code.
325N/A *
325N/A * This code is distributed in the hope that it will be useful, but WITHOUT
325N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
325N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
325N/A * version 2 for more details (a copy is included in the LICENSE file that
325N/A * accompanied this code).
325N/A *
325N/A * You should have received a copy of the GNU General Public License version
325N/A * 2 along with this work; if not, write to the Free Software Foundation,
325N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
325N/A *
325N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
325N/A * or visit www.oracle.com if you need additional information or have any
325N/A * questions.
325N/A */
325N/A
325N/Apackage javax.xml.bind;
325N/A
325N/A/**
325N/A * A basic event handler interface for validation errors.
325N/A *
325N/A * <p>
325N/A * If an application needs to implement customized event handling, it must
325N/A * implement this interface and then register it with either the
325N/A * {@link Unmarshaller#setEventHandler(ValidationEventHandler) Unmarshaller},
325N/A * the {@link Validator#setEventHandler(ValidationEventHandler) Validator}, or
325N/A * the {@link Marshaller#setEventHandler(ValidationEventHandler) Marshaller}.
325N/A * The JAXB Provider will then report validation errors and warnings encountered
325N/A * during the unmarshal, marshal, and validate operations to these event
325N/A * handlers.
325N/A *
325N/A * <p>
325N/A * If the <tt>handleEvent</tt> method throws an unchecked runtime exception,
325N/A * the JAXB Provider must treat that as if the method returned false, effectively
325N/A * terminating whatever operation was in progress at the time (unmarshal,
325N/A * validate, or marshal).
325N/A *
325N/A * <p>
325N/A * Modifying the Java content tree within your event handler is undefined
325N/A * by the specification and may result in unexpected behaviour.
325N/A *
325N/A * <p>
325N/A * Failing to return false from the <tt>handleEvent</tt> method after
325N/A * encountering a fatal error is undefined by the specification and may result
325N/A * in unexpected behavior.
325N/A *
325N/A * <p>
325N/A * <b>Default Event Handler</b>
325N/A * <blockquote>
325N/A * See: <a href="Validator.html#defaulthandler">Validator javadocs</a>
325N/A * </blockquote>
325N/A *
325N/A * @author <ul><li>Ryan Shoemaker, Sun Microsystems, Inc.</li><li>Kohsuke Kawaguchi, Sun Microsystems, Inc.</li><li>Joe Fialli, Sun Microsystems, Inc.</li></ul>
325N/A * @see Unmarshaller
325N/A * @see Validator
325N/A * @see Marshaller
325N/A * @see ValidationEvent
325N/A * @see javax.xml.bind.util.ValidationEventCollector
325N/A * @since JAXB1.0
325N/A */
325N/Apublic interface ValidationEventHandler {
325N/A /**
325N/A * Receive notification of a validation warning or error.
325N/A *
325N/A * The ValidationEvent will have a
325N/A * {@link ValidationEventLocator ValidationEventLocator} embedded in it that
325N/A * indicates where the error or warning occurred.
325N/A *
325N/A * <p>
325N/A * If an unchecked runtime exception is thrown from this method, the JAXB
325N/A * provider will treat it as if the method returned false and interrupt
325N/A * the current unmarshal, validate, or marshal operation.
325N/A *
325N/A * @param event the encapsulated validation event information. It is a
325N/A * provider error if this parameter is null.
325N/A * @return true if the JAXB Provider should attempt to continue the current
325N/A * unmarshal, validate, or marshal operation after handling this
325N/A * warning/error, false if the provider should terminate the current
325N/A * operation with the appropriate <tt>UnmarshalException</tt>,
325N/A * <tt>ValidationException</tt>, or <tt>MarshalException</tt>.
325N/A * @throws IllegalArgumentException if the event object is null.
325N/A */
325N/A public boolean handleEvent( ValidationEvent event );
325N/A
325N/A}