1 23 24 28 29 43 44 package com.sun.enterprise.admin.monitor.registry; 45 46 52 public class MonitoringLevel { 53 54 public static final MonitoringLevel OFF = new MonitoringLevel("OFF"); 55 public static final MonitoringLevel LOW = new MonitoringLevel("LOW"); 56 public static final MonitoringLevel HIGH = new MonitoringLevel("HIGH"); 57 58 private final String name; 59 60 63 private MonitoringLevel(String name ) { 64 this.name = name; 65 } 66 67 public String toString() { 68 return ( name ); 69 } 70 71 83 public static MonitoringLevel instance(String name) { 84 if (OFF.toString().equalsIgnoreCase(name)) 85 return ( OFF ); 86 else if (LOW.toString().equalsIgnoreCase(name)) 87 return ( LOW ); 88 else if (HIGH.toString().equalsIgnoreCase(name)) 89 return ( HIGH ); 90 return ( null ); 91 } 92 93 103 public boolean equals(Object obj) { 104 if (obj == this) 105 return true; 106 107 if (! (obj instanceof MonitoringLevel)) 108 return false; 109 110 MonitoringLevel that = (MonitoringLevel) obj; 111 112 return (this.name.equals(that.name)); 113 } 114 115 123 public int hashCode() { 124 return this.name.hashCode(); 125 } 126 127 } 128 | Popular Tags |