@Override public Object invokeMethod(Object instance, String mn, Class<?>[] types, Object[] args) throws NoSuchMethodException { if ("getClass".equals(mn)) return instance.getClass(); if ("hashCode".equals(mn)) return instance.hashCode(); if ("toString".equals(mn)) return instance.toString(); if ("equals".equals(mn)) { if (args.length == 1) return instance.equals(args[0]); throw new IllegalArgumentException("Invoke method [" + mn + "] argument number error."); } throw new NoSuchMethodException("Method [" + mn + "] not found."); } };
@Override public Object invokeMethod(Object instance, String mn, Class<?>[] types, Object[] args) throws NoSuchMethodException { if ("getClass".equals(mn)) return instance.getClass(); if ("hashCode".equals(mn)) return instance.hashCode(); if ("toString".equals(mn)) return instance.toString(); if ("equals".equals(mn)) { if (args.length == 1) return instance.equals(args[0]); throw new IllegalArgumentException("Invoke method [" + mn + "] argument number error."); } throw new NoSuchMethodException("Method [" + mn + "] not found."); } };
public Object invokeMethod(Object instance, String mn, Class<?>[] types, Object[] args) throws NoSuchMethodException { if( "getClass".equals(mn) ) return instance.getClass(); if( "hashCode".equals(mn) ) return instance.hashCode(); if( "toString".equals(mn) ) return instance.toString(); if( "equals".equals(mn) ) { if( args.length == 1 ) return instance.equals(args[0]); throw new IllegalArgumentException("Invoke method [" + mn + "] argument number error."); } throw new NoSuchMethodException("Method [" + mn + "] not found."); } };
public Object invokeMethod(Object instance, String mn, Class<?>[] types, Object[] args) throws NoSuchMethodException { if( "getClass".equals(mn) ) return instance.getClass(); if( "hashCode".equals(mn) ) return instance.hashCode(); if( "toString".equals(mn) ) return instance.toString(); if( "equals".equals(mn) ) { if( args.length == 1 ) return instance.equals(args[0]); throw new IllegalArgumentException("Invoke method [" + mn + "] argument number error."); } throw new NoSuchMethodException("Method [" + mn + "] not found."); } };