< prev index next >

src/java.corba/share/classes/org/omg/DynamicAny/package.html

Print this page




  31 </head>
  32 <body bgcolor="white">
  33 <P>Provides classes and interfaces that enable traversal of the data value
  34  associated with an <code>any</code> at
  35 runtime, and extraction of the primitive constituents of the data value.
  36 
  37 
  38 <P>An <code>any</code> can be passed to a program that doesn't have any static information 
  39 for the type of the <code>any</code> (code generated for the type by an IDL compiler has not 
  40 been compiled with the object implementation). As a result, the object receiving the 
  41 <code>any</code> does not have a portable method of using it.
  42 
  43 <P><code>DynAny</code>s enable traversal of the data value associated with an
  44 <code>any</code> at runtime, and extraction of the primitive constituents of the data value.
  45 This is especially helpful for writing powerful generic servers (bridges, event channels
  46 supporting filtering).  Similarly, this facility enables the construction of an
  47 <code>any</code> at runtime, without having static knowledge of its type. This is especially
  48 helpful for writing generic clients (bridges, browsers, debuggers, user interface tools).
  49 
  50 <P><code>Any</code> values can be dynamically interpreted (traversed) and constructed through
  51 <tt>DynAny</tt> objects.  A <tt>DynAny</tt> object is associated with a data
  52 value which corresponds to a copy of the value inserted into an <tt>Any</tt>.  A
  53 <tt>DynAny</tt> object may be viewed as an ordered collection of component 
  54 <tt>DynAny</tt>s. For <tt>DynAny</tt>s representing a basic type, such as <code>long</code>,
  55 or a type without components, such as an empty exception, the ordered collection of
  56 components is empty.
  57 
  58 <P>Each <tt>DynAny</tt> object maintains the notion of a current position into its collection
  59 of component <tt>DynAny</tt>s. The current position is identified by an index value that runs
  60 from 0 to n-1, where <em>n</em> is the number of components.  The special index value -1
  61 indicates a current position that points nowhere.
  62  For values that cannot have a current position (such as an empty exception),
  63  the index value is fixed at -1.
  64  If a <code>DynAny</code> is initialized with a value that has components, the index is
  65 initialized to 0.
  66  After creation of an uninitialized <code>DynAny</code> (that is, a <code>DynAny</code> that
  67 has no value but a <code>TypeCode</code>
  68  that permits components), the current position depends on the type of value represented by
  69  the <code>DynAny</code>. (The current position is set to 0 or -1, depending on whether the
  70 new <code>DynAny</code>
  71  gets default values for its components.)
  72 
  73 
  74 <P>The iteration operations <code>rewind</code>, <code>seek</code>, and <code>next</code>
  75 can be used to change the current position
  76  and the <code>current_component</code> operation returns the component at the current
  77 position.
  78  The <code>component_count</code> operation returns the number of components of a
  79 <code>DynAny</code>.




  31 </head>
  32 <body bgcolor="white">
  33 <P>Provides classes and interfaces that enable traversal of the data value
  34  associated with an <code>any</code> at
  35 runtime, and extraction of the primitive constituents of the data value.
  36 
  37 
  38 <P>An <code>any</code> can be passed to a program that doesn't have any static information 
  39 for the type of the <code>any</code> (code generated for the type by an IDL compiler has not 
  40 been compiled with the object implementation). As a result, the object receiving the 
  41 <code>any</code> does not have a portable method of using it.
  42 
  43 <P><code>DynAny</code>s enable traversal of the data value associated with an
  44 <code>any</code> at runtime, and extraction of the primitive constituents of the data value.
  45 This is especially helpful for writing powerful generic servers (bridges, event channels
  46 supporting filtering).  Similarly, this facility enables the construction of an
  47 <code>any</code> at runtime, without having static knowledge of its type. This is especially
  48 helpful for writing generic clients (bridges, browsers, debuggers, user interface tools).
  49 
  50 <P><code>Any</code> values can be dynamically interpreted (traversed) and constructed through
  51 <code>DynAny</code> objects.  A <code>DynAny</code> object is associated with a data
  52 value which corresponds to a copy of the value inserted into an <code>Any</code>.  A
  53 <code>DynAny</code> object may be viewed as an ordered collection of component 
  54 <code>DynAny</code>s. For <code>DynAny</code>s representing a basic type, such as <code>long</code>,
  55 or a type without components, such as an empty exception, the ordered collection of
  56 components is empty.
  57 
  58 <P>Each <code>DynAny</code> object maintains the notion of a current position into its collection
  59 of component <code>DynAny</code>s. The current position is identified by an index value that runs
  60 from 0 to n-1, where <em>n</em> is the number of components.  The special index value -1
  61 indicates a current position that points nowhere.
  62  For values that cannot have a current position (such as an empty exception),
  63  the index value is fixed at -1.
  64  If a <code>DynAny</code> is initialized with a value that has components, the index is
  65 initialized to 0.
  66  After creation of an uninitialized <code>DynAny</code> (that is, a <code>DynAny</code> that
  67 has no value but a <code>TypeCode</code>
  68  that permits components), the current position depends on the type of value represented by
  69  the <code>DynAny</code>. (The current position is set to 0 or -1, depending on whether the
  70 new <code>DynAny</code>
  71  gets default values for its components.)
  72 
  73 
  74 <P>The iteration operations <code>rewind</code>, <code>seek</code>, and <code>next</code>
  75 can be used to change the current position
  76  and the <code>current_component</code> operation returns the component at the current
  77 position.
  78  The <code>component_count</code> operation returns the number of components of a
  79 <code>DynAny</code>.


< prev index next >