1 43 44 package org.jfree.base.modules; 45 46 51 public class DefaultModuleInfo implements ModuleInfo 52 { 53 54 private String moduleClass; 55 56 private String majorVersion; 57 58 private String minorVersion; 59 60 private String patchLevel; 61 62 65 public DefaultModuleInfo() { 66 } 68 69 79 public DefaultModuleInfo(final String moduleClass, final String majorVersion, 80 final String minorVersion, final String patchLevel) 81 { 82 if (moduleClass == null) 83 { 84 throw new NullPointerException ("Module class must not be null."); 85 } 86 this.moduleClass = moduleClass; 87 this.majorVersion = majorVersion; 88 this.minorVersion = minorVersion; 89 this.patchLevel = patchLevel; 90 } 91 92 99 public String getModuleClass() 100 { 101 return this.moduleClass; 102 } 103 104 109 public void setModuleClass(final String moduleClass) 110 { 111 if (moduleClass == null) 112 { 113 throw new NullPointerException (); 114 } 115 this.moduleClass = moduleClass; 116 } 117 118 125 public String getMajorVersion() 126 { 127 return this.majorVersion; 128 } 129 130 137 public void setMajorVersion(final String majorVersion) 138 { 139 this.majorVersion = majorVersion; 140 } 141 142 149 public String getMinorVersion() 150 { 151 return this.minorVersion; 152 } 153 154 161 public void setMinorVersion(final String minorVersion) 162 { 163 this.minorVersion = minorVersion; 164 } 165 166 173 public String getPatchLevel() 174 { 175 return this.patchLevel; 176 } 177 178 185 public void setPatchLevel(final String patchLevel) 186 { 187 this.patchLevel = patchLevel; 188 } 189 190 196 public boolean equals(final Object o) 197 { 198 if (this == o) 199 { 200 return true; 201 } 202 if (!(o instanceof DefaultModuleInfo)) 203 { 204 return false; 205 } 206 207 final ModuleInfo defaultModuleInfo = (ModuleInfo) o; 208 209 if (!this.moduleClass.equals(defaultModuleInfo.getModuleClass())) 210 { 211 return false; 212 } 213 return true; 214 } 215 216 222 public int hashCode() 223 { 224 final int result; 225 result = this.moduleClass.hashCode(); 226 return result; 227 } 228 229 236 public String toString() 237 { 238 final StringBuffer buffer = new StringBuffer (); 239 buffer.append(getClass().getName()); 240 buffer.append("={ModuleClass="); 241 buffer.append(getModuleClass()); 242 if (getMajorVersion() != null) 243 { 244 buffer.append("; Version="); 245 buffer.append(getMajorVersion()); 246 if (getMinorVersion() != null) 247 { 248 buffer.append("-"); 249 buffer.append(getMinorVersion()); 250 if (getPatchLevel() != null) 251 { 252 buffer.append("_"); 253 buffer.append(getPatchLevel()); 254 } 255 } 256 } 257 buffer.append("}"); 258 return buffer.toString(); 259 } 260 } 261 | Popular Tags |