## org.eclipse.wst.validation.internal.provisional.core
Interface IMessage

    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

### OFFSET_UNSET

    static final int OFFSET_UNSET

See Also:
  Constant Field Values

### LINENO_UNSET

    static final int LINENO_UNSET

See Also:
  Constant Field Values

### HIGH_SEVERITY

    static final int HIGH_SEVERITY

  Typically used to specify error messages.

  See Also:
    Constant Field Values

### NORMAL_SEVERITY

    static final int NORMAL_SEVERITY

  Typically used to specify warning messages.

  See Also:
    Constant Field Values

### LOW_SEVERITY

    static final int LOW_SEVERITY

  Typically used to specify information messages.

  See Also:
    Constant Field Values

### ERROR_AND_WARNING

    static final int ERROR_AND_WARNING

  Specify high (error) and normal (warning) messages. Typically used with a MessageFilter, to filter out information messages.

  See Also:
    Constant Field Values

### ALL_MESSAGES

    static final int ALL_MESSAGES

  Specify all types of messages. Typically used with a MessageFilter.

  See Also:
    Constant Field Values

### TargetResource

    static final java.lang.String TargetResource

  TargetResource - The key to use when associating a resource with a message via an attribute.

  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.

  See Also:
    Constant Field Values

Method Detail

### getBundleName

    java.lang.String getBundleName()

  Returns:
    the name of the bundle which this message is contained in.

### getGroupName

    java.lang.String getGroupName()

  To support removal of a subset of validation messages, an IValidator may assign group names to IMessages. An IMessage subset will be identified by the name of its group. Default (null) means no group.

  Returns:
    the name of the group to which the message belongs.

### getId

    java.lang.String getId()

  Returns the id of the message. Message ids are used as the constants in property bundles which localize the description of the message in a locale-independent fashion. The id is the key, in the resource bundle, which identifies the string to be loaded. The id may not be null or the empty string.

  Returns:
    the id of the message

### getLength

    int getLength()

  Returns:
    the length of the problem area, starting from the offset. If unset, value = IMessage.OFFSET_UNSET.
  See Also:
    `getOffset()`

### getLineNumber

    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. The line number identifies the location of the problem identified by this message. If no line number has been set, #LINENO_UNSET will be returned.

  Returns:
    line number of the location of the problem.

### getOffset

    int getOffset()

  Returns the offset of the message. If unset, value = IMessage.OFFSET_UNSET. For example, if the java compiler were a validator, and it reported that a variable name was unknown, offset would identify the position of the first character of the unknown variable. The position is identified by the number of characters from the start of the file.

  Returns:
    offset of the message

### getParams

    java.lang.String[] getParams()

  Returns the parameters of the message. Message parameters are the values which are substituted into parameter slots in localized message text descriptions.

  Returns:
    parameters of the message

### getSeverity

    int getSeverity()

  Returns the severity level of the message. One of SeverityEnum constants.

  Returns:
    the severity level of the message
  See Also:
    `HIGH_SEVERITY`, `NORMAL_SEVERITY`, ``

### getTargetObject

    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".

  Returns:
    the target object for the message

### getText

    java.lang.String getText()

  Returns:
    a text representation of this message formatted in the default Locale, with the bundle loaded by the default ClassLoader.

### getText

    java.lang.String getText(java.lang.ClassLoader classLoader)

  Parameters:
    `classLoader` - The ClassLoader which will be used to load the ResourceBundle.
  Returns:
    a text representation of this message formatted in the default locale, with the bundle loaded by the specified ClassLoader.

### getText

    java.lang.String getText(java.util.Locale locale)

  Parameters:
    `locale` - The locale to translate the message text into.
  Returns:
    a text representation of this message formatted in the specified locale, with the bundle loaded by the default ClassLoader.

### getText

    java.lang.String getText(java.util.Locale locale,
                             java.lang.ClassLoader classLoader)

  Parameters:
    `locale` - The locale to translate the message text into.
    `classLoader` - The ClassLoader which will be used to load the ResourceBundle.
  Returns:
    a text representation of this message formatted in the specified locale, with the bundle loaded by the specified ClassLoader.

### getAttribute

    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.

  Parameters:
    `attributeName` -
  Returns:
    an Object basically the value associated with the object name.

### setAttribute

    void setAttribute(java.lang.String attributeName,
                      java.lang.Object value)

  Set the attributeName and value as key value pair.

  Parameters:
    `attributeName` -
  See Also:
    `getAttribute(String attributeName)`

### setBundleName

    void setBundleName(java.lang.String bundleName)

  Set the name of the bundle which this message is contained in.

  Parameters:
    `bundleName` - Name of the bundle which contains the message.

### setGroupName

    void setGroupName(java.lang.String name)

  To support removal of a subset of validation messages, an IValidator may assign group names to IMessages. An IMessage subset will be identified by the name of its group. Default (null) means no group.

  Parameters:
    `name` - Name of the group.

### setId

    void setId(java.lang.String newId)

  Set the id of the message. Message ids are used as the constants in property bundles which localize the description of the message in a locale-independent fashion. The id is the key, in the resource bundle, which identifies the string to be loaded. The id may not be null or the empty string.

  Parameters:
    `newId` - Id of the message.

### setLength

    void setLength(int length)

  Sets the length of the problem, starting from the offset. If unset, value = IMessage.OFFSET_UNSET.

  Parameters:
    `length` - Sets the length.
  See Also:
    `setOffset(int)`

### setLineNo

    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. The line number identifies the location of the problem identified by this message. To indicate no line number, use #LINENO_UNSET.

  Parameters:
    `lineNumber` - Sets the line number.

### setOffset

    void setOffset(int offset)

  Sets the offset of the message. If unset, value = IMessage.OFFSET_UNSET. For example, if the java compiler were a validator, and it reported that a variable name was unknown, offset would identify the position of the first character of the unknown variable. The position is identified by the number of characters from the start of the file.

  Parameters:
    `offset` - Sets the offset of the message.

### setParams

    void setParams(java.lang.String[] newParams)

  Sets the parameters of the message. Message parameters are the values which are substituted into parameter slots in localized message text descriptions.

  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.

  Parameters:
    `newParams` - Parameters of the message.
  See Also:
    `is invoked on the message, with `newParams` passed in as the Object[].`

### setSeverity

    void setSeverity(int newSeverity)

  Sets the severity level of the message. One of SeverityEnum constants.

  Parameters:
    `newSeverity` - Severity level of the message.
  See Also:
    `HIGH_SEVERITY`, `NORMAL_SEVERITY`, `LOW_SEVERITY`

### setTargetObject

    void setTargetObject(java.lang.Object obj)

  Associate this IMessage with the object that has the problem. A null value is permitted. If a message is applicable to one object, then this value should be set. Otherwise, the default value (null) should be kept. Given this target object, it should be possible to calculate the exact location of the problem.

  Parameters:
    `obj` - The object that has the problem.

### getAttributes

    java.util.HashMap getAttributes()

  Return all the attributes of a Message object.

### getMarkerId

    java.lang.String getMarkerId()

  Return the marker id if one is set on this object when created.

### setMarkerId

    void setMarkerId(java.lang.String markerId)

  Set the marker id on a Message object.