KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > idl > ValueBase


1 /*
2  * JacORB - a free Java ORB
3  *
4  * Copyright (C) 1997-2004 Gerald Brose.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the Free
18  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */

20
21 package org.jacorb.idl;
22
23 /**
24  * @author Gerald Brose
25  * @version $Id: ValueBase.java,v 1.2 2004/05/06 12:39:59 nicolas Exp $
26  */

27
28 class ValueBase
29     extends BaseType
30 {
31     public ValueBase( int num )
32     {
33         super( num );
34     }
35
36     public Object JavaDoc clone()
37     {
38         return this;
39     }
40
41     public String JavaDoc typeName()
42     {
43         return "java.io.Serializable";
44     }
45
46     public TypeSpec typeSpec()
47     {
48         return this;
49     }
50
51     public void setPackage( String JavaDoc s )
52     {
53         s = parser.pack_replace( s );
54     }
55
56     public boolean basic()
57     {
58         return true;
59     }
60
61     public void set_constr( TypeDeclaration td )
62     {
63     }
64
65     public void parse()
66     {
67     }
68
69     public String JavaDoc toString()
70     {
71         return typeName();
72     }
73
74     /**
75      * @return a string for an expression of type TypeCode that describes this type
76      */

77     public String JavaDoc getTypeCodeExpression()
78     {
79         return "org.omg.CORBA.ORB.init().create_value_tc(\"" + id() +
80             "\",\"ValueBase\", org.omg.CORBA.VM_NONE.value, org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_null), new org.omg.CORBA.ValueMember[]{} )";
81     }
82
83     public String JavaDoc id()
84     {
85         return "IDL:omg.org/CORBA/ValueBase:1.0";
86     }
87
88     public void print( java.io.PrintWriter JavaDoc ps )
89     {
90     }
91
92     public String JavaDoc holderName()
93     {
94         return typeName() + "Holder";
95     }
96
97     public String JavaDoc printReadExpression( String JavaDoc streamname )
98     {
99         return "((org.omg.CORBA_2_3.portable.InputStream)" + streamname + ").read_value()";
100     }
101
102     public String JavaDoc printWriteStatement( String JavaDoc var_name, String JavaDoc streamname )
103     {
104         return "((org.omg.CORBA_2_3.portable.OutputStream)" + streamname +
105             ").write_value(" + var_name + ");";
106     }
107
108
109 }
110
111
112
113
Popular Tags