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) 2008 Google Inc.
*
* 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.google.inject.internal;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Binder;
import com.google.inject.Exposed;
import com.google.inject.Key;
import com.google.inject.PrivateBinder;
import com.google.inject.Provides;
import com.google.inject.internal.InternalProviderInstanceBindingImpl.InitializationTiming;
import com.google.inject.internal.util.StackTraceElements;
import com.google.inject.spi.BindingTargetVisitor;
import com.google.inject.spi.Dependency;
import com.google.inject.spi.HasDependencies;
import com.google.inject.spi.ProviderInstanceBinding;
import com.google.inject.spi.ProviderWithExtensionVisitor;
import com.google.inject.spi.ProvidesMethodBinding;
import com.google.inject.spi.ProvidesMethodTargetVisitor;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Set;
import java.util.function.BiFunction;
/**
* A provider that invokes a method and returns its result.
*
* @author [email protected] (Jesse Wilson)
*/
public abstract class ProviderMethod extends InternalProviderInstanceBindingImpl.CyclicFactory
implements HasDependencies, ProvidesMethodBinding, ProviderWithExtensionVisitor {
/**
* Creates a {@link ProviderMethod}.
*
*
Unless {@code skipFastClassGeneration} is set, this will use bytecode generation to invoke
* the actual method, since it is significantly faster. However, this may fail if the method is
* {@code private} or {@code protected}, since this approach is subject to java access policies.
*/
static ProviderMethod create(
Key key,
Method method,
Object instance,
ImmutableSet> dependencies,
Class extends Annotation> scopeAnnotation,
boolean skipFastClassGeneration,
Annotation annotation) {
int modifiers = method.getModifiers();
if (InternalFlags.isBytecodeGenEnabled() && !skipFastClassGeneration) {
try {
BiFunction