protected Object createInstallHandler(FrameOwner frameOwner, Method method, Class<?> targetObjectType) { if (targetObjectType == Function.class) { return new InstalledFunction(frameOwner, method); } else if (targetObjectType == Consumer.class) { return new InstalledConsumer(frameOwner, method); } else if (targetObjectType == Supplier.class) { return new InstalledSupplier(frameOwner, method); } else if (targetObjectType == BiFunction.class) { return new InstalledBiFunction(frameOwner, method); } else { ClassLoader classLoader = getClass().getClassLoader(); return newProxyInstance(classLoader, new Class[]{targetObjectType}, new InstalledProxyHandler(frameOwner, method) ); } }