Method method = provider.getMethod(); for (Method matchingSignature : methodsBySignature.get(new Signature(typeLiteral, method))) {
@Override protected T doProvision(InternalContext context, Dependency<?> dependency) throws InternalProvisionException { try { T t = doProvision(SingleParameterInjector.getAll(context, parameterInjectors)); if (t == null && !dependency.isNullable()) { InternalProvisionException.onNullInjectedIntoNonNullableDependency(getMethod(), dependency); } return t; } catch (IllegalAccessException e) { throw new AssertionError(e); } catch (InvocationTargetException userException) { Throwable cause = userException.getCause() != null ? userException.getCause() : userException; throw InternalProvisionException.errorInProvider(cause).addSource(getSource()); } }
@Override public String getInstanceName(Object instance) { if (instance instanceof ProviderMethod) { return getMethodString(((ProviderMethod<?>) instance).getMethod()); } if (instance instanceof CharSequence) { return "\"" + instance + "\""; } try { if (instance.getClass().getMethod("toString").getDeclaringClass().equals(Object.class)) { return stripPackages(instance.getClass().getName()); } } catch (SecurityException e) { throw new AssertionError(e); } catch (NoSuchMethodException e) { throw new AssertionError(e); } return instance.toString(); }
ProviderMethodBinding(ErrorManager errorManager, GuiceUtil guiceUtil, MethodCallUtil methodCallUtil, ProviderMethod<?> providerMethod, Context context) { super(context, TypeLiteral.get(providerMethod.getMethod().getDeclaringClass())); this.guiceUtil = guiceUtil; this.methodCallUtil = methodCallUtil; this.moduleType = providerMethod.getInstance().getClass(); Method method = providerMethod.getMethod(); this.providerMethod = MethodLiteral.get(method, TypeLiteral.get(method.getDeclaringClass())); this.targetKey = providerMethod.getKey(); if (!ReflectUtil.hasAccessibleDefaultConstructor(method.getDeclaringClass())) { errorManager.logError( "Cannot invoke a @Provides method on a module without a default constructor. " + "Gin must be able to create the module at runtime in order to invoke an instance " + "method. Method name: %s", method); } }
Method method = provider.getMethod(); for (Method matchingSignature : methodsBySignature.get(new Signature(method))) {
Method method = provider.getMethod(); for (Method matchingSignature : methodsBySignature.get(new Signature(typeLiteral, method))) {
Method method = provider.getMethod(); for (Method matchingSignature : methodsBySignature.get(new Signature(typeLiteral, method))) {
@Override protected T doProvision(InternalContext context, Dependency<?> dependency) throws InternalProvisionException { try { T t = doProvision(SingleParameterInjector.getAll(context, parameterInjectors)); if (t == null && !dependency.isNullable()) { InternalProvisionException.onNullInjectedIntoNonNullableDependency(getMethod(), dependency); } return t; } catch (IllegalAccessException e) { throw new AssertionError(e); } catch (InvocationTargetException userException) { Throwable cause = userException.getCause() != null ? userException.getCause() : userException; throw InternalProvisionException.errorInProvider(cause).addSource(getSource()); } }
@Override protected T doProvision(InternalContext context, Dependency<?> dependency) throws InternalProvisionException { try { T t = doProvision(SingleParameterInjector.getAll(context, parameterInjectors)); if (t == null && !dependency.isNullable()) { InternalProvisionException.onNullInjectedIntoNonNullableDependency(getMethod(), dependency); } return t; } catch (IllegalAccessException e) { throw new AssertionError(e); } catch (InvocationTargetException userException) { Throwable cause = userException.getCause() != null ? userException.getCause() : userException; throw InternalProvisionException.errorInProvider(cause).addSource(getSource()); } }