Class AbstractObjectLocator

java.lang.Object
org.jvnet.basicjaxb.locator.AbstractObjectLocator
All Implemented Interfaces:
jakarta.xml.bind.ValidationEventLocator, Reportable, ObjectLocator
Direct Known Subclasses:
DefaultItemObjectLocator, DefaultPropertyObjectLocator, DefaultRootObjectLocator

public abstract class AbstractObjectLocator extends Object implements ObjectLocator
Abstract base class for event locators.
Author:
Aleksei Valikov
  • Field Details

    • parentLocator

      protected final ObjectLocator parentLocator
      Parent locator.
    • object

      protected final Object object
      Object.
  • Constructor Details

    • AbstractObjectLocator

      protected AbstractObjectLocator(ObjectLocator parentLocator, Object object)
      Constructs a new validation event locator.
      Parameters:
      parentLocator - parent location (may be null).
      object - object.
  • Method Details

    • getParentLocator

      public ObjectLocator getParentLocator()
      Returns parent locator.
      Specified by:
      getParentLocator in interface ObjectLocator
      Returns:
      Parent locator.
    • getPath

      public ObjectLocator[] getPath()
      Specified by:
      getPath in interface ObjectLocator
      Returns:
      Path to this locator from the root.
    • getPathAsString

      public String getPathAsString()
      Specified by:
      getPathAsString in interface ObjectLocator
      Returns:
      Path to this locator in string form;
    • getStepAsString

      protected abstract String getStepAsString()
    • getObject

      public Object getObject()
      Specified by:
      getObject in interface jakarta.xml.bind.ValidationEventLocator
    • getColumnNumber

      public int getColumnNumber()
      Specified by:
      getColumnNumber in interface jakarta.xml.bind.ValidationEventLocator
    • getLineNumber

      public int getLineNumber()
      Specified by:
      getLineNumber in interface jakarta.xml.bind.ValidationEventLocator
    • getOffset

      public int getOffset()
      Specified by:
      getOffset in interface jakarta.xml.bind.ValidationEventLocator
    • getURL

      public URL getURL()
      Specified by:
      getURL in interface jakarta.xml.bind.ValidationEventLocator
    • getNode

      public Node getNode()
      Specified by:
      getNode in interface jakarta.xml.bind.ValidationEventLocator
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getMessageCode

      public String getMessageCode()
      Returns message code.
      Specified by:
      getMessageCode in interface Reportable
      Returns:
      Message code.
    • getDefaultMessage

      protected abstract String getDefaultMessage()
    • getMessage

      public String getMessage(ResourceBundle bundle)
      Description copied from interface: Reportable
      Formats the message using given resource bundle.
      Specified by:
      getMessage in interface Reportable
      Parameters:
      bundle - bundle to use resources from.
      Returns:
      Formatted message.
    • getMessage

      public String getMessage()
      Returns location message.
      Specified by:
      getMessage in interface Reportable
      Returns:
      Location message.
    • item

      public ItemObjectLocator item(int index, Object value)
      Description copied from interface: ObjectLocator
      Creates a locator for the item (like list or array item) relative to this locator.
      Specified by:
      item in interface ObjectLocator
      Parameters:
      index - index of the item.
      value - value of the item.
      Returns:
      Child item locator.
    • property

      public PropertyObjectLocator property(String name, Object value)
      Description copied from interface: ObjectLocator
      Creates a locator for the property, relative to this locator.
      Specified by:
      property in interface ObjectLocator
      Parameters:
      name - name of the property, must not be null.
      value - value of the property, may be null.
      Returns:
      Child property locator.