Code example for InvocationHandler

Methods: invoke

0
 
    public String getKala(String kalamees) throws Exception {
    	String result =  null;
        try { 
        	// invocation is also generated 
            result = (String) handler.invoke(this, ProxySampleInterface_ReturnsObject.class.getMethod("getKala", new Class[] {String.class}), new Object[] {kalamees});
        } catch (ClassCastException e) {
        	throw e;
        } catch (NoSuchMethodException e) {
            throw new Error(e.getMessage());
        } catch (RuntimeException e) {
        	throw e;
        } catch (Exception e) {
        	// generated: catch the exception throwed by interface method and re-throw it 
        	throw e;
        } catch (Error e) {
        	throw e;
        } catch (Throwable e) {
        	throw new UndeclaredThrowableException(e);
        }