001 /* 002 * Copyright 2002-2004 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 005 * use this file except in compliance with the License. You may obtain a copy of 006 * the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 013 * License for the specific language governing permissions and limitations under 014 * the License. 015 */ 016 package org.springframework.richclient.core; 017 018 import org.springframework.core.enums.ShortCodedLabeledEnum; 019 020 /** 021 * A typesafe enum representing different levels of severity. Each enum has an 022 * associated label, which may be useful for defining resources such as messages 023 * and icons in properties files. 024 * 025 */ 026 public class Severity extends ShortCodedLabeledEnum { 027 028 /** The label associated with the info level. */ 029 public static final String INFO_LABEL = "info"; 030 031 /** The label associated with the warning level. */ 032 public static final String WARNING_LABEL = "warning"; 033 034 /** The label associated with the error level. */ 035 public static final String ERROR_LABEL = "error"; 036 037 private static final long serialVersionUID = 86569930382195510L; 038 039 /** Info-level severity. */ 040 public static final Severity INFO = new Severity(0, INFO_LABEL); 041 042 /** Warning-level severity. */ 043 public static final Severity WARNING = new Severity(50, WARNING_LABEL); 044 045 /** Error-level severity. */ 046 public static final Severity ERROR = new Severity(100, ERROR_LABEL); 047 048 /** 049 * Constructor. 050 * 051 * @param magnitude how does it relate to other {@link Severity} levels, a 052 * higher magnitude means more severe. 053 * @param label label to associate with, may be used to access resources 054 * like messages/icons. 055 */ 056 protected Severity(int magnitude, String label) { 057 super(magnitude, label); 058 } 059 060 }