KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > yan > Dependency


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 Feb 27, 2005
10  *
11  * Author Ben Yu
12  * ZBS
13  */

14 package jfun.yan;
15
16 import jfun.yan.function.Signature;
17
18 /**
19  * This interface is responsible for providing dependency to the
20  * creation of a component instance.
21  * <p>
22  * Codehaus.org.
23  *
24  * @author Ben Yu
25  *
26  */

27 public interface Dependency extends java.io.Serializable JavaDoc{
28   /**
29    * Get an instance of an argument.
30    * @param source the signature of the function requesting this argument.
31    * @param i the ordinal position of the argument. Starting from 0.
32    * @param type the parameter type.
33    * @return the argument instance.
34    * @throws IrresolveableArgumentException
35    * if the argument cannot be resolved.
36    * @throws ParameterTypeMismatchException
37    * if the actual type of the argument does not match the expected parameter type.
38    * @throws AmbiguousComponentResolutionException
39    * if ambiguity happens.
40    * @throws ComponentInstantiationException
41    * if any checked exception happens when instantiating the argument.
42    * @throws YanException
43    * if any other component related error happens.
44    */

45   Object JavaDoc getArgument(Signature source, int i, Class JavaDoc type)
46   throws IrresolveableArgumentException, ParameterTypeMismatchException,
47   AmbiguousComponentResolutionException, ComponentInstantiationException,
48   YanException;
49   /**
50    * Verifies that the argument instance can be resolved.
51    * The actual argument type is returned if verification succeeds.
52    * @param source the signature of the function requesting this argument.
53    * @param i the ordinal position of the argument. Starting from 0.
54    * @param type the parameter type.
55    * @return the actual type of the argument.
56    * @throws IrresolveableArgumentException
57    * if the argument cannot be resolved.
58    * @throws ParameterTypeMismatchException
59    * if the actual type of the argument does not match the expected parameter type.
60    * @throws AmbiguousComponentResolutionException
61    * if ambiguity happens.
62    * @throws YanException
63    * if any other component related error happens.
64    */

65   Class JavaDoc verifyArgument(Signature source, int i, Class JavaDoc type)
66   throws IrresolveableArgumentException,
67   ParameterTypeMismatchException,
68   AmbiguousComponentResolutionException,
69   YanException;
70   /**
71    * Get an instance of a property.
72    * @param component_type the type of the component requesting the property.
73    * @param key the key of the property.
74    * @param type the property type.
75    * @return the property instance.
76    * @throws IrresolveablePropertyException
77    * if the property cannot be resolved.
78    * @throws PropertyTypeMismatchException
79    * if the actual type of the property does not match the expected property type.
80    * @throws AmbiguousComponentResolutionException
81    * if ambiguity happens.
82    * @throws ComponentInstantiationException
83    * if any checked exception happens when instantiating the property.
84    * @throws YanException
85    * if any other component related error happens.
86    */

87   Object JavaDoc getProperty(Class JavaDoc component_type, Object JavaDoc key, Class JavaDoc type)
88   throws IrresolveablePropertyException, PropertyTypeMismatchException,
89   AmbiguousComponentResolutionException, ComponentInstantiationException,
90   YanException;
91   /**
92    * Verifies that the property instance can be resolved.
93    * The actual type of the property is returned if verification succeeds.
94    * @param component_type the type of the component requesting the property.
95    * @param key the property key.
96    * @param type the expected property type.
97    * @return the actual type of the property.
98    * @throws IrresolveablePropertyException
99    * if the property cannot be resolved.
100    * @throws PropertyTypeMismatchException
101    * if the actual type of the property does not match the expected property type.
102    * @throws AmbiguousComponentResolutionException
103    * if ambiguity happens.
104    * @throws YanException
105    * if any other component related error happens.
106    */

107   Class JavaDoc verifyProperty(Class JavaDoc component_type, Object JavaDoc key, Class JavaDoc type)
108   throws IrresolveablePropertyException, PropertyTypeMismatchException,
109   AmbiguousComponentResolutionException,
110   YanException;
111   
112   /**
113    * To get the Dependency object before the current one is customized, if any.
114    */

115   Dependency getOriginal();
116   /**
117    * Get the ComponentMap object.
118    * @return the ComponentMap object.
119    */

120   ComponentMap getComponentMap();
121   
122   /**
123    * Get the key of the component being resolved.
124    * @return the context.
125    */

126   Object JavaDoc getComponentKey();
127   
128   /**
129    * Get the dependency for the parent component.
130    * if component 1 is resolved as a part of component 2,
131    * component 2 is considered the parent component of component 1.
132    * If there's no parent component, null is returned.
133    * @return the dependency for the parent component.
134    */

135   Dependency getParent();
136   
137   /**
138    * To create a Dependency that's free of auto-wiring.
139    */

140   Dependency seal();
141 }
142
Popular Tags