Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 2011-2014 Fernando Petrola
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.dragome.utils;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.dragome.commons.AbstractProxyRelatedInvocationHandler;
import com.dragome.commons.ContinueReflection;
public class DragomeCallsiteFactory
{
protected static class InvocationHandlerForLambdas extends AbstractProxyRelatedInvocationHandler
{
private final Class> class1;
private final String methodName;
private final Object[] parameters;
private Class> returnType;
private String invokeName;
private String callType;
protected InvocationHandlerForLambdas(Class> class1, String methodName, Object[] parameters, Class> returnTypeClass, String invokeName, String callType)
{
this.class1= class1;
this.methodName= methodName;
this.parameters= parameters;
this.returnType= returnTypeClass;
this.invokeName= invokeName;
this.callType= callType;
}
@ContinueReflection
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
{
setProxy(proxy);
try
{
// if (returnType.getMethod(method.getName(), method.getParameterTypes()) != null)
if (!method.getName().equals(invokeName))
return invokeDefaultMethod(proxy, method, args);
if ("".equals(methodName))
return class1.newInstance();
List