DynAny's allow to work with data structures, exact content of those is not known at the time of compilation. In this way, the conception of DynAny remebers the java reflection mechanism. DynAny usually obtain the value from the {@link org.omg.CORBA.Any} that, if needed, can carry highly nested data structures (like array of sequences of unions). DynAny's allow to see/modify all parts of such structures. This is especially helpful for writing generic servers (bridges, event channels supporting, filtering and so on). Similarly, DynAny's can create an Any at runtime, without having static knowledge of its type. This is helpful for writing generic clients like browsers, debuggers or user interface tools.
The API clearly states that DynAny and DynAnyFactory objects are local and cannot be transferred to remote server or client. While such methods are formally defined in the corresponding helpers, they simply always throw MARSHAL.
DynAny's are created by {@link DynAnyFactory}. The factory is obtaines by
{@link org.omg.CORBA.ORB#resolve_initial_references):
ORB orb = ORB.init(new String[0], null);
DynAnyFactory f = DynAnyFactoryHelper.narrow(orb.resolve_initial_references("DynAnyFactory"));
DynAny's are also returned by some methods, invoked on another DynAny.
The primitive types like string or char are wrapped into an ordinary DynAny. It has multiple methods for setting/getting the content like {@link DynAnyOperations#get_string()} or {@link DynAnyOperations#insert_string(String)}. The more complex types like sequences or structures are wrapped into specialised DynAny's, providing means to access the enclosed members. In this case, the DynAny has the "internal cursor", normally pointing at one of the members in the data structure. The "internal cursor" can be set to the needed position {@link DynAnyOperations#seek(int)} or advanced forward ({@link DynAnyOperations#next()}. The member under cursor is returned by {@link DynAnyOperations#current_component()}. For composite DynAnys the methods like {@link DynAnyOperations#get_string()} or {@link DynAnyOperations#insert_string(String)} apply to the selected member, not to the complex DynAny in general.
DynAnys are created and optimized for traversing values extracted from anys or constructing values of anys at runtime. OMG does not recommend to use them for other purposes.
@author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)