KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sape > carbon > core > component > proxy > Invocation


1 /*
2  * The contents of this file are subject to the Sapient Public License
3  * Version 1.0 (the "License"); you may not use this file except in compliance
4  * with the License. You may obtain a copy of the License at
5  * http://carbon.sf.net/License.html.
6  *
7  * Software distributed under the License is distributed on an "AS IS" basis,
8  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
9  * the specific language governing rights and limitations under the License.
10  *
11  * The Original Code is The Carbon Component Framework.
12  *
13  * The Initial Developer of the Original Code is Sapient Corporation
14  *
15  * Copyright (C) 2003 Sapient Corporation. All Rights Reserved.
16  */

17
18 package org.sape.carbon.core.component.proxy;
19
20 import java.io.Serializable JavaDoc;
21 import java.lang.reflect.Method JavaDoc;
22
23 /**
24  * <p>This object is built to contain a call to a component within the
25  * component's facade. It is then passed through the interceptor chain
26  * to allow interceptors to handle the call appropriately.</p>
27  *
28  * Copyright 2003 Sapient
29  * @since carbon 2.0
30  * @author Greg Hinkle, March 2003
31  * @version $Revision: 1.4 $($Author: dvoet $ / $Date: 2003/05/05 21:21:14 $)
32  */

33 public class Invocation implements Serializable JavaDoc {
34     /** Holds the target object. */
35     protected Object JavaDoc target;
36
37     /** Holds the target method. */
38     protected Method JavaDoc method;
39
40     /** Holds the objects to be passed to the target method. */
41     protected Object JavaDoc[] methodArguments;
42
43     /** Holds the classes needed in the target method signature. */
44     protected Class JavaDoc[] methodSignature;
45
46     /** Indicates if this method is in the functional implementation. */
47     protected boolean isTargetFunctionalImplementation;
48
49     /**
50      * Constructs an invocation object
51      *
52      * @param target the Target object on which this method was intended to
53      * be called. Must be either the component's implementation or one of its
54      * configured decorators.
55      * @param method the method that intended
56      * @param methodArguments the arguments to the method
57      * @param methodSignature the signature of the method
58      * @param isTargetFunctionalImplementation true if this invocation's
59      * target is the component's functional implementation, false if it is
60      * one of the decorators.
61      */

62     public Invocation(
63         Object JavaDoc target,
64         Method JavaDoc method,
65         Object JavaDoc[] methodArguments,
66         Class JavaDoc[] methodSignature,
67         boolean isTargetFunctionalImplementation) {
68
69         this.target = target;
70         this.method = method;
71         this.methodArguments = methodArguments;
72         this.methodSignature = methodSignature;
73         this.isTargetFunctionalImplementation =
74             isTargetFunctionalImplementation;
75     }
76
77     /**
78      * Retrieves the target object.
79      *
80      * @return the target object
81      */

82     public Object JavaDoc getTarget() {
83         return target;
84     }
85
86     /**
87      * Gets the method being invoked.
88      *
89      * @return method being invoked
90      */

91     public Method JavaDoc getMethod() {
92         return method;
93     }
94
95     /**
96      * Returns the array of object parameters for the target method.
97      *
98      * @return array of object parameters for the target method
99      */

100     public Object JavaDoc[] getMethodArguments() {
101         return methodArguments;
102     }
103
104     /**
105      * Returns the array of classes for the target method.
106      *
107      * @return array of classes for the target method
108      */

109     public Class JavaDoc[] getMethodSignature() {
110         return methodSignature;
111     }
112
113     /**
114      * Is the intended target the component's functional implementation. This
115      * is typically used by interceptors who provide special functionality for
116      * calls to the functional impelementation.
117      *
118      * @return true if the target is the functional impelementation
119      */

120     public boolean isTargetFunctionalImplementation() {
121         return isTargetFunctionalImplementation;
122     }
123 }
124
Popular Tags