Object getProperty(String name, PropertyState[] state)
throws UnknownPropertyException, WrappedTargetException
{
PropertyData p = (PropertyData) properties.get(name);
if (p == null) {
throw new UnknownPropertyException(name, object);
}
XIdlField2 field = UnoRuntime.queryInterface(
XIdlField2.class, idlClass.getField(name));
Object value;
try {
value = field.get(
new Any(type, UnoRuntime.queryInterface(type, object)));
} catch (com.sun.star.lang.IllegalArgumentException e) {
throw new RuntimeException(
"unexpected com.sun.star.lang.IllegalArgumentException: "
+ e.getMessage());
} catch (WrappedTargetRuntimeException e) {
//FIXME A WrappedTargetRuntimeException from XIdlField2.get is not
// guaranteed to originate directly within XIdlField2.get (and thus
// have the expected semantics); it might also be passed through
// from lower layers.
if (new Type(UnknownPropertyException.class).isSupertypeOf(
AnyConverter.getType(e.TargetException))
&& (p.property.Attributes & PropertyAttribute.OPTIONAL) != 0)
{
throw new UnknownPropertyException(name, object);
} else {
throw new WrappedTargetException(
e.getMessage(), object, e.TargetException);
}
}