Search in sources :

Example 1 with NameDynAnyPair

use of org.omg.DynamicAny.NameDynAnyPair in project ACS by ACS-Community.

the class BACIIntrospector method insertTypedef.

public Any insertTypedef(TypeCode tc, java.lang.Object obj) {
    DynAny dany;
    try {
        dany = ra.getDynFact().create_dyn_any_from_type_code(tc);
    } catch (org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode e) {
        e.printStackTrace();
        return null;
    }
    //Class<?> cl = getClassType(tc);
    DynStruct str = (DynStruct) dany;
    NameDynAnyPair[] mems = str.get_members_as_dyn_any();
    try {
        if (tc.kind() == TCKind.tk_struct) {
            DataStruct ds = (DataStruct) obj;
            for (int i = 0; i < mems.length; i++) {
                mems[i].value.from_any(insertAny(mems[i].value.to_any(), ds.get(mems[i].id)));
            }
        } else {
            DataException de = (DataException) obj;
            for (int i = 0; i < mems.length; i++) {
                mems[i].value.from_any(insertAny(mems[i].value.to_any(), de.get(mems[i].id)));
            }
        }
        str.set_members_as_dyn_any(mems);
    } catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch e) {
        e.printStackTrace();
        return null;
    } catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue e) {
        e.printStackTrace();
        return null;
    }
    //displayAny(dany.to_any());
    return dany.to_any();
}
Also used : DynStruct(org.omg.DynamicAny.DynStruct) DataStruct(si.ijs.acs.objectexplorer.engine.DataStruct) DataException(si.ijs.acs.objectexplorer.engine.DataException) NameDynAnyPair(org.omg.DynamicAny.NameDynAnyPair) DynAny(org.omg.DynamicAny.DynAny)

Aggregations

DynAny (org.omg.DynamicAny.DynAny)1 DynStruct (org.omg.DynamicAny.DynStruct)1 NameDynAnyPair (org.omg.DynamicAny.NameDynAnyPair)1 DataException (si.ijs.acs.objectexplorer.engine.DataException)1 DataStruct (si.ijs.acs.objectexplorer.engine.DataStruct)1