1 8 14 package jfun.yan; 15 16 17 23 final class MappedComponent5<A,B,C,D,E,R> extends Component<R> { 24 private final Map5<A,B,C,D,E,R> m; 25 private final Creator<A> c1; 26 private final Creator<B> c2; 27 private final Creator<C> c3; 28 private final Creator<D> c4; 29 private final Creator<E> c5; 30 public boolean isConcrete(){ 31 return false; 32 } 33 36 public MappedComponent5(Creator<A> c1, Creator<B> c2, Creator<C> c3, 37 Creator<D> c4, Creator<E> c5, Map5<A,B,C,D,E,R> m) { 38 this.c1 = c1; 39 this.c2 = c2; 40 this.c3 = c3; 41 this.c4 = c4; 42 this.c5 = c5; 43 this.m = m; 44 } 45 public Class <R> getType(){ 46 return null; 47 } 48 public R create(Dependency dep){ 49 return run_map(c1.create(dep), c2.create(dep), c3.create(dep), 50 c4.create(dep), c5.create(dep)); 51 } 52 public Class verify(Dependency dep){ 53 c1.verify(dep); 54 c2.verify(dep); 55 c3.verify(dep); 56 c4.verify(dep); 57 c5.verify(dep); 58 return Object .class; 59 } 60 61 public boolean equals(Object obj) { 62 if(obj instanceof MappedComponent5){ 63 final MappedComponent5 mc2 = (MappedComponent5)obj; 64 return m.equals(mc2.m) && c1.equals(mc2.c1) && c2.equals(mc2.c2) 65 && c3.equals(mc2.c3) && c4.equals(mc2.c4) && c5.equals(mc2.c5); 66 } 67 else return false; 68 } 69 public int hashCode(){ 70 return 31*(31*(31*(c1.hashCode()*31 + c2.hashCode()) + c3.hashCode()) 71 + c4.hashCode())+c5.hashCode(); 72 } 73 public String toString(){ 74 return "map (" + c1.toString() + "," + c2.toString() + "," 75 + c3 + "," + c4 + "," + c5 + ")"; 76 } 77 private R run_map(A o1, B o2, C o3, D o4, E o5){ 78 try{ 79 return m.map(o1, o2, o3, o4, o5); 80 } 81 catch(Error e){ 82 throw e; 83 } 84 catch(YanException e){ 85 throw e; 86 } 87 catch(Throwable e){ 88 throw new jfun.yan.ComponentInstantiationException(e); 89 } 90 } 91 public boolean isSingleton(){ 92 return false; 93 } 94 } 95 | Popular Tags |