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();
}
Aggregations