com.google.inject.Inject.optional()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(211)

本文整理了Java中com.google.inject.Inject.optional()方法的一些代码示例,展示了Inject.optional()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Inject.optional()方法的具体详情如下:
包路径:com.google.inject.Inject
类名称:Inject
方法名:optional

Inject.optional介绍

暂无

代码示例

代码示例来源:origin: com.google.inject/guice

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();
}

代码示例来源:origin: com.google.inject/guice

optional = guiceInject.optional();

代码示例来源:origin: com.jwebmp.inject/guice

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();
}

代码示例来源:origin: org.sonatype.sisu/sisu-guice

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();
}

代码示例来源:origin: org.xbib/guice

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();
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.google.inject

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();
}

代码示例来源:origin: Nextdoor/bender

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();
}

代码示例来源:origin: com.google/inject

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();
}

代码示例来源:origin: com.squarespace.jersey2-guice/jersey2-guice-impl

/**
 * 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;
}

代码示例来源:origin: com.squarespace.jersey2-guice/jersey2-guice

/**
 * 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;
}

代码示例来源:origin: be.fluid-it.com.squarespace.jersey2-guice/jersey2-guice

/**
 * 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;
}

代码示例来源:origin: Squarespace/jersey2-guice

/**
 * 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;
}

代码示例来源:origin: io.github.gwtplus.gin/gin

/**
 * 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();
}

代码示例来源:origin: com.google.code.guice/guice

<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);
     }
    }
   }
  }
 }
}

代码示例来源:origin: apache/wicket

boolean optional = injectAnnotation != null && injectAnnotation.optional();
Annotation bindingAnnotation = findBindingAnnotation(field.getAnnotations());
final GuiceProxyTargetLocator locator = new GuiceProxyTargetLocator(field, bindingAnnotation, optional);

代码示例来源:origin: com.google.code.guice/guice

Inject inject = constructor.getAnnotation(Inject.class);
if (inject != null) {
 if (inject.optional()) {
  injector.errorHandler.handle(
    StackTraceElements.forMember(constructor),

代码示例来源:origin: com.google/inject

optional = guiceInject.optional();

代码示例来源:origin: org.sonatype.sisu/sisu-guice

optional = guiceInject.optional();

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.google.inject

optional = guiceInject.optional();

代码示例来源:origin: com.jwebmp.inject/guice

optional = guiceInject.optional();

相关文章