KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > yan > Mutation2Binder


1 package jfun.yan;
2
3 final class Mutation2Binder<T> implements ComponentBinder<T,T> {
4   private final Mutation<T> mut;
5   
6   Mutation2Binder(Mutation<T> mut) {
7     this.mut = mut;
8   }
9
10   public Verifiable verify(Class JavaDoc type) {
11     return Monad.verifyAs(type);
12   }
13
14   public Class JavaDoc bindType(Class JavaDoc type) {
15     return type;
16   }
17
18   public Creator<T> bind(T v) throws Throwable JavaDoc {
19     mut.mutate(v);
20     return Components.value(null);
21   }
22   public int hashCode() {
23     return mut.hashCode();
24   }
25   public String JavaDoc toString() {
26     return mut.toString();
27   }
28   public boolean equals(Object JavaDoc obj) {
29     if(obj instanceof Mutation2Binder){
30       final Mutation2Binder other = (Mutation2Binder)obj;
31       return mut.equals(other.mut);
32     }
33     else return false;
34   }
35 }
36
Popular Tags