org.jvnet.jaxb2_commons.locator
Class AbstractObjectLocator

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

public abstract class AbstractObjectLocator
extends java.lang.Object
implements ObjectLocator

Abstract base class for event locators.

Author:
Aleksei Valikov

Field Summary
protected  java.lang.Object object
          Object.
protected  ObjectLocator parentLocator
          Parent locator.
 
Constructor Summary
protected AbstractObjectLocator(ObjectLocator parentLocator, java.lang.Object object)
          Constructs a new validation event locator.
 
Method Summary
 int getColumnNumber()
           
protected abstract  java.lang.String getDefaultMessage()
           
 int getLineNumber()
           
 java.lang.String getMessage()
          Returns location message.
 java.lang.String getMessage(java.util.ResourceBundle bundle)
          Formats the message using given resource bundle.
 java.lang.String getMessageCode()
          Returns message code.
 org.w3c.dom.Node getNode()
           
 java.lang.Object getObject()
           
 int getOffset()
           
 ObjectLocator getParentLocator()
          Returns parent locator.
 ObjectLocator[] getPath()
           
 java.lang.String getPathAsString()
           
protected abstract  java.lang.String getStepAsString()
           
 java.net.URL getURL()
           
 ItemObjectLocator item(int index, java.lang.Object value)
          Creates a locator for the item (like list or array item) relative to this locator.
 PropertyObjectLocator property(java.lang.String name, java.lang.Object value)
          Creates a locator for the property, relative to this locator.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jvnet.jaxb2_commons.i18n.Reportable
getMessageParameters
 

Field Detail

parentLocator

protected final ObjectLocator parentLocator
Parent locator.


object

protected final java.lang.Object object
Object.

Constructor Detail

AbstractObjectLocator

protected AbstractObjectLocator(ObjectLocator parentLocator,
                                java.lang.Object object)
Constructs a new validation event locator.

Parameters:
parentLocator - parent location (may be null).
object - object.
propertyName - field name.
Method Detail

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 java.lang.String getPathAsString()
Specified by:
getPathAsString in interface ObjectLocator
Returns:
Path to this locator in string form;

getStepAsString

protected abstract java.lang.String getStepAsString()

getObject

public java.lang.Object getObject()
Specified by:
getObject in interface javax.xml.bind.ValidationEventLocator

getColumnNumber

public int getColumnNumber()
Specified by:
getColumnNumber in interface javax.xml.bind.ValidationEventLocator

getLineNumber

public int getLineNumber()
Specified by:
getLineNumber in interface javax.xml.bind.ValidationEventLocator

getOffset

public int getOffset()
Specified by:
getOffset in interface javax.xml.bind.ValidationEventLocator

getURL

public java.net.URL getURL()
Specified by:
getURL in interface javax.xml.bind.ValidationEventLocator

getNode

public org.w3c.dom.Node getNode()
Specified by:
getNode in interface javax.xml.bind.ValidationEventLocator

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getMessageCode

public java.lang.String getMessageCode()
Returns message code.

Specified by:
getMessageCode in interface Reportable
Returns:
Message code.

getDefaultMessage

protected abstract java.lang.String getDefaultMessage()

getMessage

public java.lang.String getMessage(java.util.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 java.lang.String getMessage()
Returns location message.

Specified by:
getMessage in interface Reportable
Returns:
Location message.

item

public ItemObjectLocator item(int index,
                              java.lang.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(java.lang.String name,
                                      java.lang.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.


Copyright © 2005-2011. All Rights Reserved.