45 * @param type the class that contains constructor 46 * @param args the types of constructor's parameters 47 */ 48 Signature(Class<?> type, Class<?>[] args) { 49 this(type, null, args); 50 } 51 52 /** 53 * Constructs signature for method. 54 * 55 * @param type the class that contains method 56 * @param name the name of the method 57 * @param args the types of method's parameters 58 */ 59 Signature(Class<?> type, String name, Class<?>[] args) { 60 this.type = type; 61 this.name = name; 62 this.args = args; 63 } 64 65 /** 66 * Indicates whether some other object is "equal to" this one. 67 * 68 * @param object the reference object with which to compare 69 * @return {@code true} if this object is the same as the 70 * {@code object} argument, {@code false} otherwise 71 * @see #hashCode() 72 */ 73 @Override 74 public boolean equals(Object object) { 75 if (this == object) { 76 return true; 77 } 78 if (object instanceof Signature) { 79 Signature signature = (Signature) object; 80 return isEqual(signature.type, this.type) 81 && isEqual(signature.name, this.name) 82 && isEqual(signature.args, this.args); 83 } 84 return false; | 45 * @param type the class that contains constructor 46 * @param args the types of constructor's parameters 47 */ 48 Signature(Class<?> type, Class<?>[] args) { 49 this(type, null, args); 50 } 51 52 /** 53 * Constructs signature for method. 54 * 55 * @param type the class that contains method 56 * @param name the name of the method 57 * @param args the types of method's parameters 58 */ 59 Signature(Class<?> type, String name, Class<?>[] args) { 60 this.type = type; 61 this.name = name; 62 this.args = args; 63 } 64 65 Class<?> getType() { 66 return this.type; 67 } 68 69 String getName() { 70 return this.name; 71 } 72 73 Class<?>[] getArgs() { 74 return this.args; 75 } 76 77 /** 78 * Indicates whether some other object is "equal to" this one. 79 * 80 * @param object the reference object with which to compare 81 * @return {@code true} if this object is the same as the 82 * {@code object} argument, {@code false} otherwise 83 * @see #hashCode() 84 */ 85 @Override 86 public boolean equals(Object object) { 87 if (this == object) { 88 return true; 89 } 90 if (object instanceof Signature) { 91 Signature signature = (Signature) object; 92 return isEqual(signature.type, this.type) 93 && isEqual(signature.name, this.name) 94 && isEqual(signature.args, this.args); 95 } 96 return false; |