KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > yan > MethodNameBinder


1 /*****************************************************************************
2  * Copyright (C) Zephyr Business Solution. All rights reserved. *
3  * ------------------------------------------------------------------------- *
4  * The software in this package is published under the terms of the BSD *
5  * style license a copy of which has been included with this distribution in *
6  * the LICENSE.txt file. *
7  *****************************************************************************/

8
9 /*
10  * Created on Apr 22, 2005
11  *
12  * Author Ben Yu
13  * ZBS
14  */

15 package jfun.yan;
16
17 /**
18  * For specifying a method name without knowing the class it belongs to.
19  * <p>
20  * Zephyr Business Solution
21  *
22  * @author Ben Yu
23  *
24  */

25 final class MethodNameBinder implements ComponentBinder {
26   public Verifiable verify(Class JavaDoc type) {
27     return Components.fun(
28         Functions.method(type, null, mname, suppress_security));
29   }
30   public Creator bind(Object JavaDoc v){
31     return Components.fun(
32         Functions.method(v, mname, suppress_security));
33   }
34   public Class JavaDoc bindType(Class JavaDoc t){
35     return null;
36   }
37   private final String JavaDoc mname;
38   private final boolean suppress_security;
39   MethodNameBinder(final String JavaDoc mname, boolean suppress_security) {
40     this.mname = mname;
41     this.suppress_security = suppress_security;
42   }
43   
44   public boolean equals(Object JavaDoc obj) {
45     if(obj instanceof MethodNameBinder){
46       final MethodNameBinder other = (MethodNameBinder)obj;
47       return suppress_security==other.suppress_security&&mname.equals(other.mname);
48     }
49     else return false;
50   }
51   public int hashCode() {
52     return mname.hashCode();
53   }
54   public String JavaDoc toString() {
55     return mname.toString();
56   }
57 }
58
Popular Tags