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 Object
implements ObjectLocator

Abstract base class for event locators.

Author:
Aleksei Valikov

Field Summary
protected  Object object
          Object.
protected  ObjectLocator parentLocator
          Parent locator.
 
Constructor Summary
protected AbstractObjectLocator(ObjectLocator parentLocator, Object object)
          Constructs a new validation event locator.
 
Method Summary
 int getColumnNumber()
           
protected abstract  String getDefaultMessage()
           
 int getLineNumber()
           
 String getMessage()
          Returns location message.
 String getMessage(ResourceBundle bundle)
          Formats the message using given resource bundle.
 String getMessageCode()
          Returns message code.
 Node getNode()
           
 Object getObject()
           
 int getOffset()
           
 ObjectLocator getParentLocator()
          Returns parent locator.
 ObjectLocator[] getPath()
           
 String getPathAsString()
           
protected abstract  String getStepAsString()
           
 URL getURL()
           
 ItemObjectLocator item(int index, Object value)
          Creates a locator for the item (like list or array item) relative to this locator.
 PropertyObjectLocator property(String name, Object value)
          Creates a locator for the property, relative to this locator.
 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 Object object
Object.

Constructor Detail

AbstractObjectLocator

protected AbstractObjectLocator(ObjectLocator parentLocator,
                                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 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 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 URL getURL()
Specified by:
getURL in interface javax.xml.bind.ValidationEventLocator

getNode

public Node getNode()
Specified by:
getNode in interface javax.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.


Copyright © 2005-2012. All Rights Reserved.