ValidationEventImpl (Java Platform SE 8 )
Keywords: javax.xml.bind.helpers.ValidationEventImpl class
Date: 2026-08-19

javax.xml.bind.helpers

## Class ValidationEventImpl

- java.lang.Object
- - javax.xml.bind.helpers.ValidationEventImpl

- All Implemented Interfaces:
    ValidationEvent
  Direct Known Subclasses:
    NotIdentifiableEventImpl, ParseConversionEventImpl, PrintConversionEventImpl

      public class ValidationEventImpl
      extends Object
      implements ValidationEvent

  Default implementation of the ValidationEvent interface.

  JAXB providers are allowed to use whatever class that implements the ValidationEvent interface. This class is just provided for a convenience.

  Since:
    JAXB1.0
  See Also:
    `Validator`, `ValidationEventHandler`, `ValidationEvent`, `ValidationEventLocator`

- - ### Field Summary

    - ### Fields inherited from interface javax.xml.bind.ValidationEvent

      `ERROR, FATAL_ERROR, WARNING`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ValidationEventImpl(int _severity, String _message, ValidationEventLocator _locator)` Create a new ValidationEventImpl.
    `ValidationEventImpl(int _severity, String _message, ValidationEventLocator _locator, Throwable _linkedException)` Create a new ValidationEventImpl.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Throwable` | `getLinkedException()` Retrieve the linked exception for this warning/error.
    `ValidationEventLocator` | `getLocator()` Retrieve the locator for this warning/error.
    `String` | `getMessage()` Retrieve the text message for this warning/error.
    `int` | `getSeverity()` Retrieve the severity code for this warning/error.
    `void` | `setLinkedException(Throwable _linkedException)` Set the linked exception field of this event.
    `void` | `setLocator(ValidationEventLocator _locator)` Set the locator object for this event.
    `void` | `setMessage(String _message)` Set the message field of this event.
    `void` | `setSeverity(int _severity)` Set the severity field of this event.
    `String` | `toString()` Returns a string representation of this object in a format helpful to debugging.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ValidationEventImpl

          public ValidationEventImpl(int _severity,
                                     String _message,
                                     ValidationEventLocator _locator)

      Create a new ValidationEventImpl.
      Parameters:
        `_severity` - The severity value for this event. Must be one of ValidationEvent.WARNING, ValidationEvent.ERROR, or ValidationEvent.FATAL_ERROR
        `_message` - The text message for this event - may be null.
        `_locator` - The locator object for this event - may be null.
      Throws:
        `IllegalArgumentException` - if an illegal severity field is supplied

    - #### ValidationEventImpl

          public ValidationEventImpl(int _severity,
                                     String _message,
                                     ValidationEventLocator _locator,
                                     Throwable _linkedException)

      Create a new ValidationEventImpl.
      Parameters:
        `_severity` - The severity value for this event. Must be one of ValidationEvent.WARNING, ValidationEvent.ERROR, or ValidationEvent.FATAL_ERROR
        `_message` - The text message for this event - may be null.
        `_locator` - The locator object for this event - may be null.
        `_linkedException` - An optional linked exception that may provide additional information about the event - may be null.
      Throws:
        `IllegalArgumentException` - if an illegal severity field is supplied

  - ### Method Detail

    - #### getSeverity

          public int getSeverity()

      Description copied from interface: `ValidationEvent`
      Retrieve the severity code for this warning/error.

      Must be one of `ValidationError.WARNING`, `ValidationError.ERROR`, or `ValidationError.FATAL_ERROR`.

      Specified by:
        `getSeverity` in interface `ValidationEvent`
      Returns:
        the severity code for this warning/error

    - #### setSeverity

          public void setSeverity(int _severity)

      Set the severity field of this event.
      Parameters:
        `_severity` - Must be one of ValidationEvent.WARNING, ValidationEvent.ERROR, or ValidationEvent.FATAL_ERROR.
      Throws:
        `IllegalArgumentException` - if an illegal severity field is supplied

    - #### getMessage

          public String getMessage()

      Description copied from interface: `ValidationEvent`
      Retrieve the text message for this warning/error.
      Specified by:
        `getMessage` in interface `ValidationEvent`
      Returns:
        the text message for this warning/error or null if one wasn't set

    - #### setMessage

          public void setMessage(String _message)

      Set the message field of this event.
      Parameters:
        `_message` - String message - may be null.

    - #### getLinkedException

          public Throwable getLinkedException()

      Description copied from interface: `ValidationEvent`
      Retrieve the linked exception for this warning/error.
      Specified by:
        `getLinkedException` in interface `ValidationEvent`
      Returns:
        the linked exception for this warning/error or null if one wasn't set

    - #### setLinkedException

          public void setLinkedException(Throwable _linkedException)

      Set the linked exception field of this event.
      Parameters:
        `_linkedException` - Optional linked exception - may be null.

    - #### getLocator

          public ValidationEventLocator getLocator()

      Description copied from interface: `ValidationEvent`
      Retrieve the locator for this warning/error.
      Specified by:
        `getLocator` in interface `ValidationEvent`
      Returns:
        the locator that indicates where the warning/error occurred

    - #### setLocator

          public void setLocator(ValidationEventLocator _locator)

      Set the locator object for this event.
      Parameters:
        `_locator` - The locator - may be null.

    - #### toString

          public String toString()

      Returns a string representation of this object in a format helpful to debugging.
      Overrides:
        `toString` in class `Object`
      Returns:
        a string representation of the object.
      See Also:
        `Object.equals(Object)`

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.