1 8 9 15 package jfun.yan.function; 16 17 25 public class Property2Signature implements Signature { 26 private final Class component_type; 27 private final Object key; 28 private final Class prop_type; 29 public Class getReturnType() { 30 return component_type; 31 } 32 33 public Class [] getParameterTypes() { 34 return new Class []{prop_type}; 35 } 36 37 public String getName() { 38 return ""+key; 39 } 40 41 47 public Property2Signature(Class component_type, Object key, Class prop_type) { 48 this.component_type = component_type; 49 this.key = key; 50 this.prop_type = prop_type; 51 } 52 53 public boolean equals(Object obj) { 54 if(obj instanceof Property2Signature){ 55 final Property2Signature other = (Property2Signature)obj; 56 return component_type.equals(other.component_type) 57 && equals(key, other.key); 58 } 59 else return false; 60 } 61 62 public int hashCode() { 63 return (component_type.hashCode()*31+key.hashCode())*31; 64 } 65 66 public String toString() { 67 return component_type.getName()+"."+key+"("+prop_type.getName()+")"; 68 } 69 private static int hcode(Object obj){ 70 return obj==null?0:obj.hashCode(); 71 } 72 private static boolean equals(Object a, Object b){ 73 return a==null?b==null:a.equals(b); 74 } 75 } 76 | Popular Tags |