KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > ast > lib > ParameterImpl


1 /*====================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
5 Contact: openccm@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Philippe Merle, Mathieu Vadet.
23 Contributor(s): Christophe Demarey.
24
25 ====================================================================*/

26
27 package org.objectweb.openccm.ast.lib;
28
29 /** To access AST TypeRef. */
30 import org.objectweb.openccm.ast.api.TypeRef;
31
32 /** To access CORBA parameter mode. */
33 import org.omg.CORBA.ParameterMode JavaDoc;
34
35 /**
36  * ParameterImpl is a wrapper class for IDL operation parameters.
37  *
38  * Inherits from:
39  * - WithNameTypeRef for the associated name and type reference.
40  *
41  * @author <a HREF="mailto:Philippe.Merle@lifl.fr">Philippe Merle</a>
42  * <a HREF="mailto:Mathieu.Vadet@lifl.fr">Mathieu Vadet</a>
43  *
44  * @version 0.1
45  */

46
47 public class ParameterImpl
48        extends WithNameTypeRefImpl
49        implements org.objectweb.openccm.ast.api.Parameter
50 {
51     // ==================================================================
52
//
53
// Internal state.
54
//
55
// ==================================================================
56

57     /** The associated mode. */
58     private ParameterMode JavaDoc mode_;
59
60     // ==================================================================
61
//
62
// Constructor.
63
//
64
// ==================================================================
65

66     /**
67      * The constructor.
68      *
69      * @param name The associated name.
70      * @param type The associated type.
71      * @param mode The associated mode.
72      */

73     public
74     ParameterImpl(String JavaDoc name,
75                   TypeRef type,
76                   ParameterMode JavaDoc mode)
77     {
78         // Call the WithNameTypeRefImpl constructor.
79
super(name, type);
80
81         // Init internal state.
82
mode_ = mode;
83     }
84
85     // ==================================================================
86
//
87
// Internal methods.
88
//
89
// ==================================================================
90

91     /**
92      * Obtain its associated CORBA::ParameterDescription.
93      *
94      * @return Its associated CORBA::ParameterDescription.
95      */

96     public org.omg.CORBA.ParameterDescription JavaDoc
97     getParameterDescription()
98     {
99         return new org.omg.CORBA.ParameterDescription JavaDoc(
100                        getName(),
101                        org.objectweb.openccm.corba.TypeCodeUtils.getTC_void(),
102                        getIDLType(),
103                        mode_);
104     }
105
106     // ==================================================================
107
//
108
// Public methods.
109
//
110
// ==================================================================
111

112     // ==================================================================
113
//
114
// Methods for OMG IDL org.objectweb.openccm.ast.api.Parameter
115
//
116
// ==================================================================
117

118     /**
119      * Obtain the parameter mode.
120      *
121      * @return The parameter mode.
122      */

123     public int
124     getMode()
125     {
126         return mode_.value();
127     }
128
129     /**
130      * Is it an in parameter?
131      *
132      * @return True if it is an in parameter, else false.
133      */

134     public boolean isIn()
135     {
136         return mode_ == ParameterMode.PARAM_IN;
137     }
138
139     /**
140      * Is it an out parameter?
141      *
142      * @return True if it is an out parameter, else false.
143      */

144     public boolean isOut()
145     {
146         return mode_ == ParameterMode.PARAM_OUT;
147     }
148
149     /**
150      * Is it an inout parameter?
151      *
152      * @return True if it is an inout parameter, else false.
153      */

154     public boolean isInOut()
155     {
156         return mode_ == ParameterMode.PARAM_INOUT;
157     }
158 }
159
Popular Tags