@PublicApi public interface

MessageSet

implements Serializable
com.atlassian.jira.util.MessageSet
Known Indirect Subclasses

@PublicApi

This interface is designed for plugins to consume (call its methods).

Clients of @PublicApi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicApi as per each product's API policy as long as the client does not implement/extend @PublicApi interfaces or classes (refer to each product's API policy for the exact guarantee---usually binary compatibility is guaranteed at least across minor versions).

Note: since @PublicApi interfaces and classes are not designed to be implemented or extended by clients, we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces annotated with @PublicSpi are safe to extend/implement).

Class Overview

Used to communicate error and warning messages.

Summary

Nested Classes
enum MessageSet.Level Message levels  
class MessageSet.MessageLink A simple class for holding link text and a link url. 
Public Methods
void addErrorMessage(String errorMessage)
Adds an error message.
void addErrorMessage(String errorMessage, MessageSet.MessageLink link)
Adds an error message and associates a link with the error.
void addErrorMessageInEnglish(String errorMessage)
Adds an error message in English.
void addMessage(MessageSet.Level level, String errorMessage)
Adds a message with the given warning / error level
void addMessage(MessageSet.Level level, String errorMessage, MessageSet.MessageLink link)
Adds an error message with the given warning / error level and associates a link with the error.
void addMessageSet(MessageSet messageSet)
Will concatenate this message set with the provided message set.
void addWarningMessage(String warningMessage)
Adds a warning message.
void addWarningMessage(String warningMessage, MessageSet.MessageLink link)
Adds a warning message and associates a link with the warning.
void addWarningMessageInEnglish(String warningMessage)
Adds a warning message in English.
Set<String> getErrorMessages()
Set<String> getErrorMessagesInEnglish()
Returns a unique set of all the English error messages.
MessageSet.MessageLink getLinkForError(String errorMsg)
MessageSet.MessageLink getLinkForWarning(String warningMsg)
Set<String> getWarningMessages()
Set<String> getWarningMessagesInEnglish()
Returns a unique set of all the English warning messages.
boolean hasAnyErrors()
Returns true if there are error messages, false otherwise.
boolean hasAnyMessages()
Returns true if there are messages of any type, false otherwise.
boolean hasAnyWarnings()
Returns true if there are warning messages, false otherwise.

Public Methods

public void addErrorMessage (String errorMessage)

Adds an error message.

Parameters
errorMessage the message to add.

public void addErrorMessage (String errorMessage, MessageSet.MessageLink link)

Adds an error message and associates a link with the error.

Parameters
errorMessage the message to add.
link the link to show the users associated with this error.

public void addErrorMessageInEnglish (String errorMessage)

Adds an error message in English.

This is useful when the addErrorMessage(String) method is used to add translated messages, and you want to be able to get a set of the messages in English as well. Eg, in the Project Import we show the translated messages on screen during validation, and log the English versions in case Atlassian Support needs to read the logs later.

Parameters
errorMessage the message to add.

public void addMessage (MessageSet.Level level, String errorMessage)

Adds a message with the given warning / error level

Parameters
level message level
errorMessage the message to add.

public void addMessage (MessageSet.Level level, String errorMessage, MessageSet.MessageLink link)

Adds an error message with the given warning / error level and associates a link with the error.

Parameters
level message level
errorMessage the message to add.
link the link to show the users associated with this error.

public void addMessageSet (MessageSet messageSet)

Will concatenate this message set with the provided message set. All new errors and warnings will be added to the existing errors and warnings.

Parameters
messageSet contains the new errors and warnings to add to this set.

public void addWarningMessage (String warningMessage)

Adds a warning message.

Parameters
warningMessage the message to add.

public void addWarningMessage (String warningMessage, MessageSet.MessageLink link)

Adds a warning message and associates a link with the warning.

Parameters
warningMessage the message to add.
link the link to show the users associated with this warning.

public void addWarningMessageInEnglish (String warningMessage)

Adds a warning message in English.

This is useful when the addWarningMessage(String) method is used to add translated messages, and you want to be able to get a set of the messages in English as well. Eg, in the Project Import we show the translated messages on screen during validation, and log the English versions in case Atlassian Support needs to read the logs later.

Parameters
warningMessage the message to add.

public Set<String> getErrorMessages ()

Returns
  • a unique set of error messages, these messages are separate from the warning messages, never null.

public Set<String> getErrorMessagesInEnglish ()

Returns a unique set of all the English error messages.

Returns
  • a unique set of all the English error messages.

public MessageSet.MessageLink getLinkForError (String errorMsg)

Parameters
errorMsg the unique error message
Returns
  • the MessageLink that is associated with the error, if one exists, null otherwise.

public MessageSet.MessageLink getLinkForWarning (String warningMsg)

Parameters
warningMsg the unique warning message
Returns
  • the MessageLink that is associated with the warning, if one exists, null otherwise.

public Set<String> getWarningMessages ()

Returns
  • a unique set of warning messages, these messages are separate from the error messages, never null.

public Set<String> getWarningMessagesInEnglish ()

Returns a unique set of all the English warning messages.

Returns
  • a unique set of all the English warning messages.

public boolean hasAnyErrors ()

Returns true if there are error messages, false otherwise.

Returns
  • true if there are error messages, false otherwise.

public boolean hasAnyMessages ()

Returns true if there are messages of any type, false otherwise. That is, it will return true if hasAnyErrors() is true or hasAnyWarnings() is true.

Returns
  • true if there are messages of any type, false otherwise.

public boolean hasAnyWarnings ()

Returns true if there are warning messages, false otherwise.

Returns
  • true if there are warning messages, false otherwise.