public class ValidationMessage
extends Object
DDMS components are validated during instantiation, and a component is either valid or does not exist. These messages are either embedded in a thrown InvalidDDMSException (in which case they are errors), or stored as informational messages on the component itself (warnings).
The locator string provides additional information about the context of the error or warning. This string is implemented as an XPath string right now: if the error was coming from a ddms:identifier component, the locator would be "/ddms:identifier". Should a parent component choose to report the warnings/errors of a child component, the locator string could be expanded with parent information, such as "/ddms:resource/ddms:identifier".
Please note that the XPath string is not intended to drill all the way down to the offending element or attribute. It should merely provide enough context so that the source of the message can be discovered.
Modifier and Type | Field and Description |
---|---|
static String |
ELEMENT_PREFIX
XPath prefix to separate elements
|
static String |
ERROR_TYPE
Constant type for an error.
|
static String |
WARNING_TYPE
Constant type for a warning.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getLocator()
Accessor for the locator
|
String |
getText()
Accessor for the text
|
String |
getType()
Accessor for the type
|
int |
hashCode() |
static ValidationMessage |
newError(String text,
String locator)
Factory method to create an error
|
static ValidationMessage |
newWarning(String text,
String locator)
Factory method to create a warning
|
void |
setLocator(String locator)
Accessor for the locator.
|
String |
toString() |
public static final String WARNING_TYPE
public static final String ERROR_TYPE
public static final String ELEMENT_PREFIX
public static ValidationMessage newWarning(String text, String locator)
text
- the description textlocator
- a locator string, in XPath format. For attributes, use empty string. The parent element will claim
the attributes.public static ValidationMessage newError(String text, String locator)
text
- the description textlocator
- a locator string, in XPath format. For attributes, use empty string. The parent element will claim
the attributes.public String toString()
toString
in class Object
Object.toString()
public boolean equals(Object obj)
equals
in class Object
Object.equals(Object)
public int hashCode()
hashCode
in class Object
Object.hashCode()
public String getType()
public String getText()
public String getLocator()
public void setLocator(String locator)
If the locator is null, it will be set to an empty string. If not, it will be prefixed with a forward-slash.
Copyright 2010 - 2019 by Brian Uri!
Generated on 09/15/2016 12:36 PM
https://ddmsence.urizone.net/