|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.wst.validation.ValidatorMessage
public class ValidatorMessage
This class provides a way for a validator to return messages, that are easily converted into IMarkers.
This class is completely optional for validators. A validator can choose to directly manage IMarkers. However, some validators want to be used in multiple contexts, for example as-you-type validation and build based validation. For these types of validators it is not possible for them to use only IMarkers, because often the Resource has not been saved yet.
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 java.lang.String |
ValidationId
|
Method Summary | |
---|---|
ValidatorMessage |
asCopy()
Answer a copy of yourself. |
static ValidatorMessage |
create(java.lang.String message,
IResource resource)
Create a new validation message. |
java.lang.Object |
getAttribute(java.lang.String attributeName)
Returns the attribute with the given name. |
boolean |
getAttribute(java.lang.String attributeName,
boolean defaultValue)
Returns the boolean valued attribute with the given name. |
int |
getAttribute(java.lang.String attributeName,
int defaultValue)
Returns the integer valued attribute with the given name. |
java.lang.String |
getAttribute(java.lang.String attributeName,
java.lang.String defaultValue)
Returns the string valued attribute with the given name. |
java.util.Map |
getAttributes()
Returns a map with all the attributes for the marker. |
IResource |
getResource()
Returns the resource with which this marker is associated. |
java.lang.String |
getType()
Returns the type of this marker. |
void |
setAttribute(java.lang.String attributeName,
boolean value)
Sets the boolean valued attribute with the given name. |
void |
setAttribute(java.lang.String attributeName,
int value)
Sets the integer valued attribute with the given name. |
void |
setAttribute(java.lang.String attributeName,
java.lang.Object value)
Sets the attribute with the given name. |
void |
setAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)
Sets the attributes for this marker to be the ones contained in the given table. |
void |
setAttributes(java.lang.String[] attributeNames,
java.lang.Object[] values)
Sets the given attribute key-value pairs on this marker. |
void |
setType(java.lang.String type)
Sets the marker type. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ValidationId
Method Detail |
---|
public static ValidatorMessage create(java.lang.String message, IResource resource)
message
- The localized message that will be displayed to the user.resource
- The resource that the message is associated with.public ValidatorMessage asCopy()
public java.lang.Object getAttribute(java.lang.String attributeName)
String
, Integer
,
or Boolean
. Returns null
if the attribute is
undefined.
attributeName
- The name of the attribute.
null
if the attribute is undefined.public int getAttribute(java.lang.String attributeName, int defaultValue)
attributeName
- The name of the attribute.defaultValue
- The value to use if no integer value is found.
public java.lang.String getAttribute(java.lang.String attributeName, java.lang.String defaultValue)
attributeName
- The name of the attribute.defaultValue
- The value to use if no value is found.
public boolean getAttribute(java.lang.String attributeName, boolean defaultValue)
attributeName
- The name of the attribute.defaultValue
- The value to use if no value is found.
public java.util.Map getAttributes()
null
is returned.
String
value type : String
,
Integer
, or Boolean
) or null
.public IResource getResource()
public java.lang.String getType()
null
.
public void setType(java.lang.String type)
type
- The marker id to use when creating new markers.public void setAttribute(java.lang.String attributeName, int value)
This method changes resources; these changes will be reported in a subsequent resource change event, including an indication that this marker has been modified.
attributeName
- The name of the attribute.value
- The value.public void setAttribute(java.lang.String attributeName, java.lang.Object value)
null
or an instance of one of the following classes:
String
, Integer
, or Boolean
.
attributeName
- The name of the attribute.value
- The value, or null
if the attribute is to be undefined.public void setAttribute(java.lang.String attributeName, boolean value)
attributeName
- The name of the attribute.value
- The value.public void setAttributes(java.lang.String[] attributeNames, java.lang.Object[] values)
null
or an instance of one of the following classes:
String
, Integer
, or Boolean
. If a
value is null
, the new value of the attribute is considered
to be undefined.
attributeNames
- An array of attribute names.values
- An array of attribute values.public void setAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)
String
, Integer
, or Boolean
.
Attributes previously set on the marker but not included in the given map
are considered to be removals. This includes the text of the message.
Setting the given map to be
null
is equivalent to removing all marker attributes.
attributes
- A map of attribute names to attribute values (key type :
String
value type : String
,
Integer
, or Boolean
) or null
.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |