while (undoAmbiguous || undoDefaulted || undoOptional) {
String typeName = AnyConverter.getType(value).getTypeName();
if (undoAmbiguous
&& typeName.startsWith("com.sun.star.beans.Ambiguous<"))
{
XIdlClass ambiguous = getReflection(typeName);
try {
isAmbiguous = AnyConverter.toBoolean(
UnoRuntime.queryInterface(
XIdlField2.class,
ambiguous.getField("IsAmbiguous")).get(value));
value = UnoRuntime.queryInterface(
XIdlField2.class,
ambiguous.getField("Value")).get(value);
} catch (com.sun.star.lang.IllegalArgumentException e) {
throw new RuntimeException(
"unexpected"
+ " com.sun.star.lang.IllegalArgumentException: "
+ e.getMessage());
}
undoAmbiguous = false;
} else if (undoDefaulted
&& typeName.startsWith("com.sun.star.beans.Defaulted<"))
{
XIdlClass defaulted = getReflection(typeName);
try {
isDefaulted = AnyConverter.toBoolean(
UnoRuntime.queryInterface(
XIdlField2.class,
defaulted.getField("IsDefaulted")).get(value));
value = UnoRuntime.queryInterface(
XIdlField2.class,
defaulted.getField("Value")).get(value);
} catch (com.sun.star.lang.IllegalArgumentException e) {
throw new RuntimeException(
"unexpected"
+ " com.sun.star.lang.IllegalArgumentException: "
+ e.getMessage());
}
undoDefaulted = false;
} else if (undoOptional
&& typeName.startsWith("com.sun.star.beans.Optional<"))
{
XIdlClass optional = getReflection(typeName);
try {
boolean present = AnyConverter.toBoolean(
UnoRuntime.queryInterface(
XIdlField2.class,
optional.getField("IsPresent")).get(value));
if (!present) {
value = Any.VOID;
break;
}
value = UnoRuntime.queryInterface(
XIdlField2.class,
optional.getField("Value")).get(value);
} catch (com.sun.star.lang.IllegalArgumentException e) {
throw new RuntimeException(
"unexpected"
+ " com.sun.star.lang.IllegalArgumentException: "
+ e.getMessage());