Package org.cyclos.model.utils
Enum NotificationLevel
- java.lang.Object
-
- java.lang.Enum<NotificationLevel>
-
- org.cyclos.model.utils.NotificationLevel
-
- All Implemented Interfaces:
Serializable,Comparable<NotificationLevel>
public enum NotificationLevel extends Enum<NotificationLevel>
A severity for a notification shown to users
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ERRORINFORMATIONWARNING
-
Field Summary
Fields Modifier and Type Field Description static StringERROR_PREFIXstatic StringINFORMATION_PREFIXstatic StringWARNING_PREFIX
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Pair<NotificationLevel,String>process(String text)Returns the level and the processed notification text.static NotificationLevelvalueOf(String name)Returns the enum constant of this type with the specified name.static NotificationLevel[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INFORMATION
public static final NotificationLevel INFORMATION
-
WARNING
public static final NotificationLevel WARNING
-
ERROR
public static final NotificationLevel ERROR
-
-
Field Detail
-
INFORMATION_PREFIX
public static final String INFORMATION_PREFIX
- See Also:
- Constant Field Values
-
WARNING_PREFIX
public static final String WARNING_PREFIX
- See Also:
- Constant Field Values
-
ERROR_PREFIX
public static final String ERROR_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
values
public static NotificationLevel[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (NotificationLevel c : NotificationLevel.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static NotificationLevel valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
process
public static Pair<NotificationLevel,String> process(String text)
Returns the level and the processed notification text. If the text starts with eitherINFORMATION_PREFIX,WARNING_PREFIXorERROR_PREFIX, the prefix is removed and the corresponding level is returned. If there is no prefix, returns the unmodified text and theINFORMATIONlevel.
-
-