autofixture.generators.objects.implementationdetails.MethodCall Maven / Gradle / Ivy
package autofixture.generators.objects.implementationdetails;
import autofixture.exceptions.ObjectCreationException;
import autofixture.interfaces.Call;
import autofixture.interfaces.FixtureContract;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.reflect.Invokable;
import com.google.common.reflect.Parameter;
import com.google.common.reflect.TypeToken;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.ParameterizedType;
import java.util.ArrayList;
import java.util.List;
public class MethodCall implements Call {
private final Invokable invokable;
public MethodCall(final Invokable invokable) {
this.invokable = invokable;
}
public static
Call to(final Invokable invokable) {
return new MethodCall<>(invokable);
}
@Override
public ImmutableList getParameters() {
return invokable.getParameters();
}
private TReturnType invoke(final TOwnerType ownerType, final List