1 8 9 15 package jfun.yan; 16 17 import jfun.util.beans.Bean; 18 import jfun.util.beans.BeanType; 19 import jfun.yan.function.Function; 20 21 27 final class IndexedPropertyWritingBinder 28 extends BeanPropertyComponentBinder implements ComponentBinder { 29 private final BeanType beanType; 30 private final String prop; 31 private final int ind; 32 33 IndexedPropertyWritingBinder(final BeanType beanType, 34 final String prop, final int ind) { 35 this.beanType = beanType; 36 this.prop = prop; 37 this.ind = ind; 38 } 39 Function toFunction(Object v){ 40 return Functions.indexed_setter(Bean.instance(beanType,v), prop, ind); 41 } 42 public boolean equals(Object obj) { 43 if(obj instanceof IndexedPropertyWritingBinder){ 44 final IndexedPropertyWritingBinder other = (IndexedPropertyWritingBinder)obj; 45 return ind==other.ind && prop.equals(other.prop) && beanType.equals(other.beanType); 46 } 47 else return false; 48 } 49 public int hashCode() { 50 return (beanType.hashCode()*31+prop.hashCode())*31+ind; 51 } 52 } 53 | Popular Tags |