KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > yan > DelegatingDependency


1 /*****************************************************************************
2  * Copyright (C) Codehaus.org. 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  * Created on Mar 7, 2005
10  *
11  * Author Ben Yu
12  * ZBS
13  */

14 package jfun.yan;
15
16 import jfun.yan.function.Signature;
17
18 /**
19  * The base class for delegating to a Dependency object.
20  * It forwards all method call to the delegated Dependency object,
21  * which makes it handy for customizing a Dependency object by subclassing.
22  * <p>
23  * Codehaus.org.
24  *
25  * @author Ben Yu
26  *
27  */

28 abstract class DelegatingDependency implements Dependency {
29   private final Dependency pp;
30   /**
31    * Gets the Dependency object being delegated.
32    * @return the Dependency object.
33    */

34   protected final Dependency getDelegateTarget(){
35     return pp;
36   }
37
38   DelegatingDependency(final Dependency pp) {
39     this.pp = pp;
40   }
41   public boolean equals(Object JavaDoc other) {
42     /*
43     if(other instanceof DelegatingDependency){
44       final DelegatingDependency prov2 = (DelegatingDependency)other;
45       return pp.equals(prov2.pp);
46     }
47     else return pp.equals(other);*/

48     return this==other;
49   }
50   public Object JavaDoc getArgument(final Signature src, int i, Class JavaDoc type){
51     return pp.getArgument(src, i, type);
52   }
53   
54   public ComponentMap getComponentMap() {
55     return pp.getComponentMap();
56   }
57   public Object JavaDoc getProperty(Class JavaDoc component_type, Object JavaDoc local_key, Class JavaDoc type){
58     return pp.getProperty(component_type, local_key, type);
59   }
60   public int hashCode() {
61     return pp.hashCode();
62   }
63   public String JavaDoc toString() {
64     return pp.toString();
65   }
66   public Class JavaDoc verifyArgument(final Signature src, int i, Class JavaDoc type){
67     return pp.verifyArgument(src, i, type);
68   }
69   public Class JavaDoc verifyProperty(Class JavaDoc component_type, Object JavaDoc local_key, Class JavaDoc type){
70     return pp.verifyProperty(component_type, local_key, type);
71   }
72
73   public Object JavaDoc getComponentKey() {
74     return pp.getComponentKey();
75   }
76   public Dependency getParent(){
77     return null;
78   }
79   public Dependency getOriginal(){
80     return pp.getOriginal();
81   }
82 }
83
Popular Tags