1 18 19 package com.martiansoftware.nailgun; 20 21 30 public class Alias implements Comparable { 31 32 35 private String name; 36 37 40 private String description; 41 42 45 private Class clazz; 46 47 53 public Alias(String name, String description, Class clazz) { 54 if (name == null) throw (new IllegalArgumentException ("Alias must have a name.")); 55 this.name = name.trim(); 56 if (this.name.length() == 0) throw (new IllegalArgumentException ("Alias must have a name.")); 57 58 if (clazz == null) throw (new IllegalArgumentException ("Alias must have an associated class.")); 59 this.description = description; 60 this.clazz = clazz; 61 } 62 63 69 public Class getAliasedClass() { 70 return(clazz); 71 } 72 73 77 public String getName() { 78 return (name); 79 } 80 81 85 public String getDescription() { 86 return (description); 87 } 88 89 92 public int hashCode() { 93 return (name.hashCode()); 94 } 95 96 102 public boolean equals(Object o) { 103 return (compareTo(o) == 0); 104 } 105 106 110 public int compareTo(Object o) { 111 return (name.compareTo(((Alias) o).getName())); 112 } 113 } 114 | Popular Tags |