1 package org.omg.DynamicAny; 2 3 4 /** 5 * org/omg/DynamicAny/DynAnyFactoryOperations.java . 6 * Generated by the IDL-to-Java compiler (portable), version "3.2" 7 * from ../../../../src/share/classes/org/omg/DynamicAny/DynamicAny.idl 8 * Saturday, February 9, 2008 9:40:12 AM GMT 9 */ 10 11 12 /** 13 * DynAny objects can be created by invoking operations on the DynAnyFactory object. 14 * Generally there are only two ways to create a DynAny object: 15 * <UL> 16 * <LI>invoking an operation on an existing DynAny object 17 * <LI>invoking an operation on a DynAnyFactory object 18 * </UL> 19 * A constructed DynAny object supports operations that enable the creation of new DynAny 20 * objects encapsulating access to the value of some constituent. 21 * DynAny objects also support the copy operation for creating new DynAny objects. 22 * A reference to the DynAnyFactory object is obtained by calling ORB.resolve_initial_references() 23 * with the identifier parameter set to the string constant "DynAnyFactory". 24 * <P>Dynamic interpretation of an any usually involves creating a DynAny object using create_dyn_any() 25 * as the first step. Depending on the type of the any, the resulting DynAny object reference can be narrowed 26 * to a DynFixed, DynStruct, DynSequence, DynArray, DynUnion, DynEnum, or DynValue object reference. 27 * <P>Dynamic creation of an any involves creating a DynAny object using create_dyn_any_from_type_code(), 28 * passing the TypeCode associated with the value to be created. The returned reference is narrowed to one of 29 * the complex types, such as DynStruct, if appropriate. Then, the value can be initialized by means of 30 * invoking operations on the resulting object. Finally, the to_any operation can be invoked 31 * to create an any value from the constructed DynAny. 32 */ 33 public interface DynAnyFactoryOperations 34 { 35 36 /** 37 * Creates a new DynAny object from an any value. 38 * A copy of the TypeCode associated with the any value is assigned to the resulting DynAny object. 39 * The value associated with the DynAny object is a copy of the value in the original any. 40 * The current position of the created DynAny is set to zero if the passed value has components, 41 * to -1 otherwise 42 * 43 * @exception InconsistentTypeCode if value has a TypeCode with a TCKind of tk_Principal, 44 * tk_native, or tk_abstract_interface 45 */ 46 org.omg.DynamicAny.DynAny create_dyn_any (org.omg.CORBA.Any value) throws org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode; 47 48 /** 49 * Creates a DynAny from a TypeCode. Depending on the TypeCode, the created object may be of type DynAny, 50 * or one of its derived types, such as DynStruct. The returned reference can be narrowed to the derived type. 51 * In all cases, a DynAny constructed from a TypeCode has an initial default value. 52 * The default values of basic types are: 53 * <UL> 54 * <LI>false for boolean 55 * <LI>zero for numeric types 56 * <LI>zero for types octet, char, and wchar 57 * <LI>the empty string for string and wstring 58 * <LI>null for object references 59 * <LI>a type code with a TCKind value of tk_null for type codes 60 * <LI>for any values, an any containing a type code with a TCKind value of tk_null type and no value 61 * </UL> 62 * For complex types, creation of the corresponding DynAny assigns a default value as follows: 63 * <UL> 64 * <LI>For DynSequence it sets the current position to -1 and creates an empty sequence. 65 * <LI>For DynEnum it sets the current position to -1 and sets the value of the enumerator 66 * to the first enumerator value indicated by the TypeCode. 67 * <LI>For DynFixed it sets the current position to -1 and sets the value zero. 68 * <LI>For DynStruct it sets the current position to -1 for empty exceptions 69 * and to zero for all other TypeCodes. The members (if any) are (recursively) initialized 70 * to their default values. 71 * <LI>For DynArray sets the current position to zero and (recursively) initializes elements 72 * to their default value. 73 * <LI>For DynUnion sets the current position to zero. The discriminator value is set 74 * to a value consistent with the first named member of the union. That member is activated and (recursively) 75 * initialized to its default value. 76 * <LI>For DynValue and DynValueBox it initializes to a null value. 77 * </UL> 78 */ 79 org.omg.DynamicAny.DynAny create_dyn_any_from_type_code (org.omg.CORBA.TypeCode type) throws org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode; 80 } // interface DynAnyFactoryOperations 81