/** * Returns {@code true} if a given request element allows null values. {@link * RequestKind#INSTANCE} requests must be annotated with {@code @Nullable} in order to allow null * values. All other request kinds implicitly allow null values because they are are wrapped * inside {@link Provider}, {@link Lazy}, etc. */ private boolean allowsNull(RequestKind kind, Optional<DeclaredType> nullableType) { return nullableType.isPresent() || !kind.equals(INSTANCE); } }
/** Returns whether this request is of the given kind. */ final boolean isRequestKind(RequestKind requestKind) { return requestKind.equals(requestKind().orElse(null)); }
private ContributionBinding.Builder<?, ?> syntheticOptionalBindingBuilder( RequestKind requestKind, ResolvedBindings underlyingKeyBindings) { return !underlyingKeyBindings.isEmpty() && (underlyingKeyBindings.bindingTypes().contains(BindingType.PRODUCTION) || requestKind.equals(RequestKind.PRODUCER) // handles producerFromProvider cases || requestKind.equals(RequestKind.PRODUCED)) // handles producerFromProvider cases ? ProductionBinding.builder() : ProvisionBinding.builder(); }
/** Returns the {@link RequestKind} that matches the wrapping types (if any) of {@code type}. */ static RequestKind getRequestKind(TypeMirror type) { checkTypePresent(type); for (RequestKind kind : FRAMEWORK_CLASSES.keySet()) { if (matchesKind(kind, type)) { if (kind.equals(PROVIDER) && matchesKind(LAZY, extractKeyType(kind, type))) { return PROVIDER_OF_LAZY; } return kind; } } return INSTANCE; }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof OptionalFactories.PresentFactorySpec) { OptionalFactories.PresentFactorySpec that = (OptionalFactories.PresentFactorySpec) o; return (this.frameworkType.equals(that.frameworkType())) && (this.optionalKind.equals(that.optionalKind())) && (this.valueKind.equals(that.valueKind())); } return false; }
futureType, dependencyFutureName(dependency), dependency.kind().equals(RequestKind.PRODUCED) ? CodeBlock.of("$T.createFutureProduced($L)", PRODUCERS, futureAccess) : futureAccess);
private static CodeBlock injectionMethodArgument( DependencyRequest dependency, CodeBlock argument, ClassName generatedTypeName) { TypeMirror keyType = dependency.key().type(); CodeBlock.Builder codeBlock = CodeBlock.builder(); if (!isRawTypeAccessible(keyType, generatedTypeName.packageName()) && isTypeAccessibleFrom(keyType, generatedTypeName.packageName())) { if (!dependency.kind().equals(RequestKind.INSTANCE)) { TypeName usageTypeName = accessibleType(dependency); codeBlock.add("($T) ($T)", usageTypeName, rawTypeName(usageTypeName)); } else if (dependency.requestElement().get().asType().getKind().equals(TypeKind.TYPEVAR)) { codeBlock.add("($T)", keyType); } } return codeBlock.add(argument).build(); }
.forEach( entryPoint -> { if (entryPoint.kind().equals(MEMBERS_INJECTION)) { requestResolver.resolveMembersInjection(entryPoint.key()); } else {
if (dependencyRequest.kind().equals(RequestKind.INSTANCE) && !isTypeAccessibleFrom(dependencyType, requestingClass.packageName()) && isRawTypeAccessible(dependencyType, requestingClass.packageName())) {