&& type.getName().startsWith("com.sun.star.beans.Ambiguous<"))
{
Object[] strct = new Object[1];
type.createObject(strct);
try {
XIdlField2 field = (XIdlField2) UnoRuntime.queryInterface(
XIdlField2.class, type.getField("Value"));
field.set(
strct,
wrapValue(
value, field.getType(), false, false, wrapDefaulted,
isDefaulted, wrapOptional));
((XIdlField2) UnoRuntime.queryInterface(
XIdlField2.class, type.getField("IsAmbiguous"))).set(
strct, new Boolean(isAmbiguous));
} catch (com.sun.star.lang.IllegalArgumentException e) {
throw new RuntimeException(
"unexpected com.sun.star.lang.IllegalArgumentException: "
+ e.getMessage());
} catch (com.sun.star.lang.IllegalAccessException e) {
throw new RuntimeException(
"unexpected com.sun.star.lang.IllegalAccessException: "
+ e.getMessage());
}
return strct[0];
} else if (wrapDefaulted
&& type.getName().startsWith(
"com.sun.star.beans.Defaulted<"))
{
Object[] strct = new Object[1];
type.createObject(strct);
try {
XIdlField2 field = (XIdlField2) UnoRuntime.queryInterface(
XIdlField2.class, type.getField("Value"));
field.set(
strct,
wrapValue(
value, field.getType(), wrapAmbiguous, isAmbiguous,
false, false, wrapOptional));
((XIdlField2) UnoRuntime.queryInterface(
XIdlField2.class, type.getField("IsDefaulted"))).set(
strct, new Boolean(isDefaulted));
} catch (com.sun.star.lang.IllegalArgumentException e) {
throw new RuntimeException(
"unexpected com.sun.star.lang.IllegalArgumentException: "
+ e.getMessage());
} catch (com.sun.star.lang.IllegalAccessException e) {
throw new RuntimeException(
"unexpected com.sun.star.lang.IllegalAccessException: "
+ e.getMessage());
}
return strct[0];
} else if (wrapOptional
&& type.getName().startsWith("com.sun.star.beans.Optional<"))
{
Object[] strct = new Object[1];
type.createObject(strct);
boolean present = !AnyConverter.isVoid(value);
try {
((XIdlField2) UnoRuntime.queryInterface(
XIdlField2.class, type.getField("IsPresent"))).set(
strct, new Boolean(present));
if (present) {
XIdlField2 field = (XIdlField2) UnoRuntime.queryInterface(
XIdlField2.class, type.getField("Value"));
field.set(
strct,
wrapValue(
value, field.getType(), wrapAmbiguous, isAmbiguous,
wrapDefaulted, isDefaulted, false));
}
} catch (com.sun.star.lang.IllegalArgumentException e) {
throw new RuntimeException(
"unexpected com.sun.star.lang.IllegalArgumentException: "