KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > impl > dynamicany > DynStructImpl


1 /*
2  * @(#)DynStructImpl.java 1.8 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.corba.se.impl.dynamicany;
9
10 import org.omg.CORBA.TypeCode JavaDoc;
11 import org.omg.CORBA.TCKind JavaDoc;
12 import org.omg.CORBA.Any JavaDoc;
13 import org.omg.CORBA.TypeCodePackage.BadKind JavaDoc;
14 import org.omg.CORBA.TypeCodePackage.Bounds JavaDoc;
15 import org.omg.DynamicAny.*;
16 import org.omg.DynamicAny.DynAnyPackage.TypeMismatch JavaDoc;
17 import org.omg.DynamicAny.DynAnyPackage.InvalidValue JavaDoc;
18 import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode JavaDoc;
19
20 import com.sun.corba.se.spi.orb.ORB ;
21 import com.sun.corba.se.spi.logging.CORBALogDomains ;
22 import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
23
24 public class DynStructImpl extends DynAnyComplexImpl implements DynStruct
25 {
26     //
27
// Constructors
28
//
29

30     private DynStructImpl() {
31         this(null, (Any JavaDoc)null, false);
32     }
33
34     protected DynStructImpl(ORB orb, Any JavaDoc any, boolean copyValue) {
35         // We can be sure that typeCode is of kind tk_struct
36
super(orb, any, copyValue);
37         // Initialize components lazily, on demand.
38
// This is an optimization in case the user is only interested in storing Anys.
39
}
40
41     protected DynStructImpl(ORB orb, TypeCode JavaDoc typeCode) {
42         // We can be sure that typeCode is of kind tk_struct
43
super(orb, typeCode);
44         // For DynStruct, the operation sets the current position to -1
45
// for empty exceptions and to zero for all other TypeCodes.
46
// The members (if any) are (recursively) initialized to their default values.
47
index = 0;
48     }
49
50     //
51
// Methods differing from DynValues
52
//
53

54     public org.omg.DynamicAny.NameValuePair JavaDoc[] get_members () {
55         if (status == STATUS_DESTROYED) {
56         throw wrapper.dynAnyDestroyed() ;
57         }
58         checkInitComponents();
59         return nameValuePairs;
60     }
61
62     public org.omg.DynamicAny.NameDynAnyPair JavaDoc[] get_members_as_dyn_any () {
63         if (status == STATUS_DESTROYED) {
64         throw wrapper.dynAnyDestroyed() ;
65         }
66         checkInitComponents();
67         return nameDynAnyPairs;
68     }
69 }
70
Popular Tags