InjectableMember(TypeLiteral<?> declaringType, Annotation atInject) { this.declaringType = declaringType; if (atInject.annotationType() == javax.inject.Inject.class) { optional = false; jsr330 = true; return; } jsr330 = false; optional = ((Inject) atInject).optional(); }
optional = guiceInject.optional();
InjectableMember(TypeLiteral<?> declaringType, Annotation atInject) { this.declaringType = declaringType; if (atInject.annotationType() == javax.inject.Inject.class) { optional = false; jsr330 = true; return; } jsr330 = false; optional = ((Inject) atInject).optional(); }
InjectableMember(TypeLiteral<?> declaringType, Annotation atInject) { this.declaringType = declaringType; if (atInject.annotationType() == javax.inject.Inject.class) { optional = false; jsr330 = true; return; } jsr330 = false; optional = ((Inject) atInject).optional(); }
InjectableMember(TypeLiteral<?> declaringType, Annotation atInject) { this.declaringType = declaringType; if (atInject.annotationType() == javax.inject.Inject.class) { optional = false; jsr330 = true; return; } jsr330 = false; optional = ((Inject) atInject).optional(); }
InjectableMember(TypeLiteral<?> declaringType, Annotation atInject) { this.declaringType = declaringType; if (atInject.annotationType() == javax.inject.Inject.class) { optional = false; jsr330 = true; return; } jsr330 = false; optional = ((Inject) atInject).optional(); }
InjectableMember(TypeLiteral<?> declaringType, Annotation atInject) { this.declaringType = declaringType; if (atInject.annotationType() == javax.inject.Inject.class) { optional = false; jsr330 = true; return; } jsr330 = false; optional = ((Inject) atInject).optional(); }
InjectableMember(TypeLiteral<?> declaringType, Annotation atInject) { this.declaringType = declaringType; if (atInject.annotationType() == javax.inject.Inject.class) { optional = false; jsr330 = true; return; } jsr330 = false; optional = ((Inject) atInject).optional(); }
/** * Returns {@code true} if the given {@link AnnotatedElement} has a * {@link com.google.inject.Inject} {@link Annotation} and it's marked * as being optional. * * @see com.google.inject.Inject#optional() */ private static boolean isGuiceOptional(AnnotatedElement element) { com.google.inject.Inject inject = element.getAnnotation(com.google.inject.Inject.class); if (inject != null) { return inject.optional(); } return false; }
/** * Returns {@code true} if the given {@link AnnotatedElement} has a * {@link com.google.inject.Inject} {@link Annotation} and it's marked * as being optional. * * @see com.google.inject.Inject#optional() */ private static boolean isGuiceOptional(AnnotatedElement element) { com.google.inject.Inject inject = element.getAnnotation(com.google.inject.Inject.class); if (inject != null) { return inject.optional(); } return false; }
/** * Returns {@code true} if the given {@link AnnotatedElement} has a * {@link com.google.inject.Inject} {@link Annotation} and it's marked * as being optional. * * @see com.google.inject.Inject#optional() */ private static boolean isGuiceOptional(AnnotatedElement element) { com.google.inject.Inject inject = element.getAnnotation(com.google.inject.Inject.class); if (inject != null) { return inject.optional(); } return false; }
/** * Returns {@code true} if the given {@link AnnotatedElement} has a * {@link com.google.inject.Inject} {@link Annotation} and it's marked * as being optional. * * @see com.google.inject.Inject#optional() */ private static boolean isGuiceOptional(AnnotatedElement element) { com.google.inject.Inject inject = element.getAnnotation(com.google.inject.Inject.class); if (inject != null) { return inject.optional(); } return false; }
/** * Returns true if the passed method has an {@literal @}{@code Inject} * annotation and the injection is marked as optional ( * {@literal @}{@code Inject(optional = true)}). * * Note that {@link javax.inject.Inject} does not have an optional parameter * and therefore cannot be optional. * * @param member method to be checked * @return true if method is injected optionally */ public boolean isOptional(MemberLiteral<?, ?> member) { Inject annotation = member.getAnnotation(Inject.class); return annotation != null && annotation.optional(); }
<M extends Member & AnnotatedElement> void addInjectorsForMembers( List<M> members, boolean statics, List<SingleMemberInjector> injectors, SingleInjectorFactory<M> injectorFactory) { for (M member : members) { if (isStatic(member) == statics) { Inject inject = member.getAnnotation(Inject.class); if (inject != null) { try { injectors.add(injectorFactory.create(this, member)); } catch (MissingDependencyException e) { if (!inject.optional()) { // TODO: Report errors for more than one parameter per member. e.handle(errorHandler); } } } } } }
boolean optional = injectAnnotation != null && injectAnnotation.optional(); Annotation bindingAnnotation = findBindingAnnotation(field.getAnnotations()); final GuiceProxyTargetLocator locator = new GuiceProxyTargetLocator(field, bindingAnnotation, optional);
Inject inject = constructor.getAnnotation(Inject.class); if (inject != null) { if (inject.optional()) { injector.errorHandler.handle( StackTraceElements.forMember(constructor),
optional = guiceInject.optional();
optional = guiceInject.optional();
optional = guiceInject.optional();
optional = guiceInject.optional();