1 30 31 34 package com.nightlabs.ipanema.module; 35 36 39 public class ModuleType 40 { 41 public static final String _MODULE_TYPE_WEB = "WEB"; 42 public static final String _MODULE_TYPE_EJB = "EJB"; 43 44 public static final ModuleType MODULE_TYPE_WEB = new ModuleType(_MODULE_TYPE_WEB, true); 45 public static final ModuleType MODULE_TYPE_EJB = new ModuleType(_MODULE_TYPE_EJB, true); 46 47 private transient boolean readOnly = false; 48 public ModuleType() 49 { 50 moduleType = _MODULE_TYPE_WEB; 51 } 52 53 protected ModuleType(String _moduleType, boolean _readOnly) 54 { 55 this(_moduleType); 56 this.readOnly = _readOnly; 57 } 58 59 public ModuleType(String _moduleType) 60 { 61 this.moduleType = _moduleType; 62 } 63 64 private String moduleType; 65 66 69 public String getModuleType() { 70 return moduleType; 71 } 72 75 public void setModuleType(String moduleType) { 76 if (readOnly) 77 throw new IllegalStateException ("This instance of ModuleType is readonly!"); 78 this.moduleType = moduleType; 79 } 80 81 84 public boolean equals(Object obj) { 85 if (!(obj instanceof ModuleType)) 86 return false; 87 88 ModuleType other = (ModuleType)obj; 89 return this.moduleType.equals(other.moduleType); 90 } 91 94 public int hashCode() { 95 return moduleType.hashCode(); 96 } 97 98 private String thisString = null; 99 102 public String toString() { 103 if (thisString == null) { 104 StringBuffer sb = new StringBuffer (); 105 sb.append(this.getClass().getName()); 106 sb.append('{'); 107 sb.append(moduleType.toString()); 108 sb.append('}'); 109 thisString = sb.toString(); 110 } 111 return thisString; 112 } 113 } 114
| Popular Tags
|