Coverage Report - org.jtheque.core.managers.event.EventLevel
 
Classes in this File Line Coverage Branch Coverage Complexity
EventLevel
0 %
0/14
0 %
0/3
2
 
 1  
 package org.jtheque.core.managers.event;
 2  
 
 3  
 /*
 4  
  * This file is part of JTheque.
 5  
  *
 6  
  * JTheque is free software: you can redistribute it and/or modify
 7  
  * it under the terms of the GNU General Public License as published by
 8  
  * the Free Software Foundation, either version 3 of the License.
 9  
  *
 10  
  * JTheque is distributed in the hope that it will be useful,
 11  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13  
  * GNU General Public License for more details.
 14  
  *
 15  
  * You should have received a copy of the GNU General Public License
 16  
  * along with JTheque.  If not, see <http://www.gnu.org/licenses/>.
 17  
  */
 18  
 
 19  
 /**
 20  
  * An event level.
 21  
  *
 22  
  * @author Baptiste Wicht
 23  
  */
 24  0
 public enum EventLevel {
 25  0
     INFO(100, "event.levels.info"),
 26  0
     WARN(50, "event.levels.warn"),
 27  0
     ERROR(10, "event.levels.error");
 28  
 
 29  
     private final String key;
 30  
     private final int value;
 31  
 
 32  
     /**
 33  
      * Create a new Event Level.
 34  
      *
 35  
      * @param value The value.
 36  
      * @param key   The internationalization key.
 37  
      */
 38  0
     EventLevel(int value, String key) {
 39  0
         this.value = value;
 40  0
         this.key = key;
 41  0
     }
 42  
 
 43  
     /**
 44  
      * Return the internationalization key.
 45  
      *
 46  
      * @return The internationalization of the level.
 47  
      */
 48  
     public String getKey() {
 49  0
         return key;
 50  
     }
 51  
 
 52  
     /**
 53  
      * Return the int value of the event level.
 54  
      *
 55  
      * @return The int value of the event level.
 56  
      */
 57  
     public int intValue() {
 58  0
         return value;
 59  
     }
 60  
 
 61  
     /**
 62  
      * Return the EventLevel corresponding to the value.
 63  
      *
 64  
      * @param value The int value.
 65  
      * @return The EventLevel corresponding to the value.
 66  
      */
 67  
     public static EventLevel get(int value) {
 68  0
         switch (value) {
 69  
             case 50:
 70  0
                 return WARN;
 71  
             case 10:
 72  0
                 return ERROR;
 73  
             default:
 74  0
                 return INFO;
 75  
         }
 76  
     }
 77  
 }