* @param property the property whose value should be retrieved
* @return the value asociated with the property
* @throws IllegalArgumentException if an error occurs while reading the property
*/
public NSObject getProperty(SpeechProperty property) throws IllegalArgumentException {
ObjCObjectByReference errorPtr = new ObjCObjectByReference();
NSObject result = objectForProperty_error(property.getNativeValue(), errorPtr);
NSError error = errorPtr.getValueAs(NSError.class);
//objectForProperty:error isn't well documented, so be very conservative
if ( result != null && !result.id().isNull() && (error == null || error.id().isNull() || error.code().intValue() == 0) ) {
return result;
} else {
throw new IllegalArgumentException("Could not get property: " + property + ", error: " + error.localizedDescription());