1 package jfun.yan; 2 3 4 12 final class FieldNameBinder implements ComponentBinder { 13 public Verifiable verify(Class type) { 14 return Components.fun(Functions 15 .field(type, null, name, suppress_security)); 16 } 17 public Creator bind(Object v){ 18 if(v==null){ 19 throw new NullPointerException ("cannot access field " 20 + name +" on null."); 21 } 22 return Components.fun( 23 Functions.field(v, name, suppress_security)); 24 } 25 public Class bindType(Class t){ 26 return null; 27 } 28 private final String name; 29 private final boolean suppress_security; 30 FieldNameBinder(final String mname, final boolean suppress_security) { 31 this.name = mname; 32 this.suppress_security = suppress_security; 33 } 34 35 public boolean equals(Object obj) { 36 if(obj instanceof FieldNameBinder){ 37 final FieldNameBinder other = (FieldNameBinder)obj; 38 return suppress_security==other.suppress_security && name.equals(other.name); 39 } 40 else return false; 41 } 42 public int hashCode() { 43 return name.hashCode(); 44 } 45 public String toString() { 46 return name.toString(); 47 } 48 } | Popular Tags |