You can extend the ObjectModelAdaptor
class.
Override the getProperty
method to include a try
/catch
block, and use your custom handling in the catch
block for a STNoSuchPropertyException
.
public class MyModelAdaptor extends ObjectModelAdaptor {
@Override
public Object getProperty(Interpreter interp, ST self, Object o, Object property, String propertyName) {
try {
return super.getProperty(interp, self, o, property, propertyName);
} catch (STNoSuchPropertyException ex) {
throw new STNoSuchPropertyException("TODO: custom handling goes here");
}
}
}