com.jgoodies.validation
Enum Severity

java.lang.Object
  extended by java.lang.Enum<Severity>
      extended by com.jgoodies.validation.Severity
All Implemented Interfaces:
Serializable, Comparable<Severity>

public enum Severity
extends Enum<Severity>

An enumeration for the severities used in ValidationMessage. Useful to categorize validation results, for example to prevent an object from being saved if the primary key is missing.

The severity is used in almost all views that present validation messages and is used in operations on instances of ValidationResult.

Version:
$Revision: 1.10 $
Author:
Karsten Lentzsch
See Also:
ValidationMessage, ValidationResult

Enum Constant Summary
ERROR
          Indicates a problem that cannot be resumed or worked around.
OK
          Returned by empty validation results to indicate that no problem has been detected, or in other words, everything is fine.
WARNING
          Indicates a problem that can be resumed or handled in a reasonable way.
 
Method Summary
static Severity max(Severity severity1, Severity severity2)
          Returns the higher of the given severities by comparing their ordinals.
static Severity valueOf(String name)
          Returns the enum constant of this type with the specified name.
static Severity[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

ERROR

public static final Severity ERROR
Indicates a problem that cannot be resumed or worked around. For example it prevents an edited value to be saved.


WARNING

public static final Severity WARNING
Indicates a problem that can be resumed or handled in a reasonable way. For example a field value may break a constraint but the object can be temporarily saved.


OK

public static final Severity OK
Returned by empty validation results to indicate that no problem has been detected, or in other words, everything is fine.

Method Detail

values

public static Severity[] 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 (Severity c : Severity.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Severity 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 name
NullPointerException - if the argument is null

max

public static Severity max(Severity severity1,
                           Severity severity2)
Returns the higher of the given severities by comparing their ordinals. Since the higher severities have a lower ordinal, this method returns the severity with the lower ordinal.

Parameters:
severity1 - the first severity to check
severity2 - the second severity to check
Returns:
the higher of the given severities


Copyright © 2003-2011 JGoodies Karsten Lentzsch. All Rights Reserved.