|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IMessage
This interface represents a locale-independent validation message.
Given these three values as input, this interface can be queried for the final message string. (i.e., the message with the parameters already substituted in.) Either the default Locale can be used, or the caller can specify a Locale.
Provisional API: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.
Field Summary | |
---|---|
static int |
ALL_MESSAGES
Specify all types of messages. |
static int |
ERROR_AND_WARNING
Specify high (error) and normal (warning) messages. |
static int |
HIGH_SEVERITY
Typically used to specify error messages. |
static int |
LINENO_UNSET
|
static int |
LOW_SEVERITY
Typically used to specify information messages. |
static int |
NORMAL_SEVERITY
Typically used to specify warning messages. |
static int |
OFFSET_UNSET
|
static java.lang.String |
TargetResource
TargetResource - The key to use when associating a resource with a message via an attribute. |
Method Summary | |
---|---|
java.lang.Object |
getAttribute(java.lang.String attributeName)
Provides a way to store some additional attributes that a message would like to store that can used by some other parties that are interested in those attribute values. |
java.util.HashMap |
getAttributes()
Return all the attributes of a Message object. |
java.lang.String |
getBundleName()
|
java.lang.String |
getGroupName()
To support removal of a subset of validation messages, an IValidator may assign group names to IMessages. |
java.lang.String |
getId()
Returns the id of the message. |
int |
getLength()
|
int |
getLineNumber()
If there is a target object associated with this IMessage, and that target object is a file, then an optional line number may be set. |
java.lang.String |
getMarkerId()
Return the marker id if one is set on this object when created. |
int |
getOffset()
Returns the offset of the message. |
java.lang.String[] |
getParams()
Returns the parameters of the message. |
int |
getSeverity()
Returns the severity level of the message. |
java.lang.Object |
getTargetObject()
Return the object that this IMessage is reporting the problem against, if any. null will be returned if this is a general message which does not apply to a particular object; for example, "internal error". |
java.lang.String |
getText()
|
java.lang.String |
getText(java.lang.ClassLoader classLoader)
|
java.lang.String |
getText(java.util.Locale locale)
|
java.lang.String |
getText(java.util.Locale locale,
java.lang.ClassLoader classLoader)
|
void |
setAttribute(java.lang.String attributeName,
java.lang.Object value)
Set the attributeName and value as key value pair. |
void |
setBundleName(java.lang.String bundleName)
Set the name of the bundle which this message is contained in. |
void |
setGroupName(java.lang.String name)
To support removal of a subset of validation messages, an IValidator may assign group names to IMessages. |
void |
setId(java.lang.String newId)
Set the id of the message. |
void |
setLength(int length)
Sets the length of the problem, starting from the offset. |
void |
setLineNo(int lineNumber)
If there is a target object associated with this IMessage, and that target object is a file, then an optional line number may be set. |
void |
setMarkerId(java.lang.String markerId)
Set the marker id on a Message object. |
void |
setOffset(int offset)
Sets the offset of the message. |
void |
setParams(java.lang.String[] newParams)
Sets the parameters of the message. |
void |
setSeverity(int newSeverity)
Sets the severity level of the message. |
void |
setTargetObject(java.lang.Object obj)
Associate this IMessage with the object that has the problem. |
Field Detail |
---|
static final int OFFSET_UNSET
static final int LINENO_UNSET
static final int HIGH_SEVERITY
static final int NORMAL_SEVERITY
static final int LOW_SEVERITY
static final int ERROR_AND_WARNING
static final int ALL_MESSAGES
static final java.lang.String TargetResource
Normally, the target is stored using the setTargetObject() method, but some of the legacy validators used this field for objects that where not IResources. In order to associate the message with the proper IResource the validator can store the IResource as an attribute and use this string as the key.
Method Detail |
---|
java.lang.String getBundleName()
java.lang.String getGroupName()
java.lang.String getId()
int getLength()
getOffset()
int getLineNumber()
int getOffset()
java.lang.String[] getParams()
int getSeverity()
Returns the severity level of the message. One of SeverityEnum constants.
HIGH_SEVERITY
,
NORMAL_SEVERITY
,
java.lang.Object getTargetObject()
java.lang.String getText()
java.lang.String getText(java.lang.ClassLoader classLoader)
classLoader
- The ClassLoader which will be used to load the ResourceBundle.
java.lang.String getText(java.util.Locale locale)
locale
- The locale to translate the message text into.
java.lang.String getText(java.util.Locale locale, java.lang.ClassLoader classLoader)
locale
- The locale to translate the message text into.classLoader
- The ClassLoader which will be used to load the ResourceBundle.
java.lang.Object getAttribute(java.lang.String attributeName)
attributeName
-
void setAttribute(java.lang.String attributeName, java.lang.Object value)
attributeName
- getAttribute(String attributeName)
void setBundleName(java.lang.String bundleName)
bundleName
- Name of the bundle which contains the message.void setGroupName(java.lang.String name)
name
- Name of the group.void setId(java.lang.String newId)
newId
- Id of the message.void setLength(int length)
length
- Sets the length.setOffset(int)
void setLineNo(int lineNumber)
lineNumber
- Sets the line number.void setOffset(int offset)
offset
- Sets the offset of the message.void setParams(java.lang.String[] newParams)
For example, if getId() returns "MY_ID", then the ResourceBundle identified by getBundleName() is searched for the message named "MY_ID", and if found, has it's parameters set.
newParams
- Parameters of the message.is invoked on the message, with
newParams
passed in as the Object[].
void setSeverity(int newSeverity)
newSeverity
- Severity level of the message.HIGH_SEVERITY
,
NORMAL_SEVERITY
,
LOW_SEVERITY
void setTargetObject(java.lang.Object obj)
obj
- The object that has the problem.java.util.HashMap getAttributes()
java.lang.String getMarkerId()
void setMarkerId(java.lang.String markerId)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |