View Javadoc
1   /*
2    * #%L
3    * Nuiton Validator
4    * %%
5    * Copyright (C) 2013 - 2014 Code Lutin, Tony Chemit
6    * %%
7    * This program is free software: you can redistribute it and/or modify
8    * it under the terms of the GNU Lesser General Public License as 
9    * published by the Free Software Foundation, either version 3 of the 
10   * License, or (at your option) any later version.
11   * 
12   * This program is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   * GNU General Lesser Public License for more details.
16   * 
17   * You should have received a copy of the GNU General Lesser Public 
18   * License along with this program.  If not, see
19   * <http://www.gnu.org/licenses/lgpl-3.0.html>.
20   * #L%
21   */
22  package org.nuiton.validator;
23  
24  import static org.nuiton.i18n.I18n.n;
25  
26  /**
27   * The differents levels of messages in validation process.
28   *
29   * The order of the enum defines the severity of validation.
30   *
31   * Always begin with fatal, then error, then if no error found, try warning, then info...
32   *
33   * @author Tony Chemit - chemit@codelutin.com
34   * @since 2.0
35   */
36  public enum NuitonValidatorScope {
37  
38      /**
39       * the fatal error scope level.
40       *
41       * When a message of a such scope is found on a validator, then the
42       * validator is invalid and modified.
43       */
44      FATAL(n("validator.scope.fatal.label")),
45      /**
46       * the error scope level.
47       *
48       * When a message of a such scope is found on a validator, then the
49       * validator is invalid and modified.
50       */
51      ERROR(n("validator.scope.error.label")),
52      /**
53       * the warning scope level.
54       *
55       * When a message of a such scope is found on a validator, then the
56       * validator is still valid but modified.
57       */
58      WARNING(n("validator.scope.warning.label")),
59      /**
60       * the information scope level.
61       *
62       * When a message of a sucg scope is found on a validator, then the
63       * validator is still valid and not modified.
64       */
65      INFO(n("validator.scope.info.label"));
66  
67      private final String label;
68  
69      NuitonValidatorScope(String label) {
70          this.label = label;
71      }
72  
73      public String getLabel() {
74          return label;
75      }
76  }