com.google.inject.internal.Annotations.isBindingAnnotation()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(168)

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

Annotations.isBindingAnnotation介绍

[英]Returns true if annotations of the specified type are binding annotations.
[中]如果指定类型的批注是绑定批注,则返回true。

代码示例

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

private static void ensureIsBindingAnnotation(Class<? extends Annotation> annotationType) {
 checkArgument(
   Annotations.isBindingAnnotation(annotationType),
   "%s is not a binding annotation. Please annotate it with @BindingAnnotation.",
   annotationType.getName());
}

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

/** Returns the binding annotation on {@code member}, or null if there isn't one. */
public static Annotation findBindingAnnotation(
  Errors errors, Member member, Annotation[] annotations) {
 Annotation found = null;
 for (Annotation annotation : annotations) {
  Class<? extends Annotation> annotationType = annotation.annotationType();
  if (isBindingAnnotation(annotationType)) {
   if (found != null) {
    errors.duplicateBindingAnnotations(member, found.annotationType(), annotationType);
   } else {
    found = annotation;
   }
  }
 }
 return found;
}

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

private static void ensureIsBindingAnnotation(Class<? extends Annotation> annotationType) {
 checkArgument(
   Annotations.isBindingAnnotation(annotationType),
   "%s is not a binding annotation. Please annotate it with @BindingAnnotation.",
   annotationType.getName());
}

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

private static void ensureIsBindingAnnotation(Class<? extends Annotation> annotationType) {
 checkArgument(
   Annotations.isBindingAnnotation(annotationType),
   "%s is not a binding annotation. Please annotate it with @BindingAnnotation.",
   annotationType.getName());
}

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

private static void ensureIsBindingAnnotation(Class<? extends Annotation> annotationType) {
  checkArgument(Annotations.isBindingAnnotation(annotationType),
      "%s is not a binding annotation. Please annotate it with @BindingAnnotation.",
      annotationType.getName());
}

代码示例来源:origin: com.mycila.guice.extensions/mycila-guice-injection

private static Key<?> buildKey(TypeLiteral<?> type, Annotation[] annotations) {
  for (Annotation annotation : annotations)
    if (Annotations.isBindingAnnotation(annotation.annotationType()))
      return Key.get(type, annotation);
  return Key.get(type);
}

代码示例来源:origin: mycila/guice

private static Key<?> buildKey(TypeLiteral<?> type, Annotation[] annotations) {
  for (Annotation annotation : annotations)
    if (Annotations.isBindingAnnotation(annotation.annotationType()))
      return Key.get(type, annotation);
  return Key.get(type);
}

代码示例来源:origin: mycila/guice

private static Key<?> buildKey(TypeLiteral<?> type, Annotation[] annotations) {
  for (Annotation annotation : annotations)
    if (Annotations.isBindingAnnotation(annotation.annotationType()))
      return Key.get(type, annotation);
  return Key.get(type);
}

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

/**
   * Returns the unique binding annotation from the specified list, or
   * {@code null} if there are none.
   *
   * @throws IllegalStateException if multiple binding annotations exist.
   */
  private Annotation getBindingAnnotation(Annotation[] annotations) {
    Annotation bindingAnnotation = null;
    for (Annotation annotation : annotations) {
      if (Annotations.isBindingAnnotation(annotation.annotationType())) {
        checkArgument(bindingAnnotation == null,
            "Parameter has multiple binding annotations: %s and %s", bindingAnnotation, annotation);
        bindingAnnotation = annotation;
      }
    }
    return bindingAnnotation;
  }
}

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

private static void ensureIsBindingAnnotation(Class<? extends Annotation> annotationType) {
 checkArgument(Annotations.isBindingAnnotation(annotationType),
   "%s is not a binding annotation. Please annotate it with @BindingAnnotation.",
   annotationType.getName());
}

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

private static void ensureIsBindingAnnotation(Class<? extends Annotation> annotationType) {
 checkArgument(Annotations.isBindingAnnotation(annotationType),
   "%s is not a binding annotation. Please annotate it with @BindingAnnotation.",
   annotationType.getName());
}

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

private static void ensureIsBindingAnnotation(Class<? extends Annotation> annotationType) {
 checkArgument(Annotations.isBindingAnnotation(annotationType),
   "%s is not a binding annotation. Please annotate it with @BindingAnnotation.",
   annotationType.getName());
}

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

/** Returns the binding annotation on {@code member}, or null if there isn't one. */
public static Annotation findBindingAnnotation(
  Errors errors, Member member, Annotation[] annotations) {
 Annotation found = null;
 for (Annotation annotation : annotations) {
  Class<? extends Annotation> annotationType = annotation.annotationType();
  if (isBindingAnnotation(annotationType)) {
   if (found != null) {
    errors.duplicateBindingAnnotations(member, found.annotationType(), annotationType);
   } else {
    found = annotation;
   }
  }
 }
 return found;
}

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

/** Returns the binding annotation on {@code member}, or null if there isn't one. */
public static Annotation findBindingAnnotation(
  Errors errors, Member member, Annotation[] annotations) {
 Annotation found = null;
 for (Annotation annotation : annotations) {
  Class<? extends Annotation> annotationType = annotation.annotationType();
  if (isBindingAnnotation(annotationType)) {
   if (found != null) {
    errors.duplicateBindingAnnotations(member, found.annotationType(), annotationType);
   } else {
    found = annotation;
   }
  }
 }
 return found;
}

代码示例来源:origin: com.mycila.guice.extensions/mycila-guice-injection

@Override
public Key<?> getKey(TypeLiteral<?> injectedType, Field injectedMember, A resourceAnnotation) {
  for (Annotation annotation : injectedMember.getAnnotations())
    if (Annotations.isBindingAnnotation(annotation.annotationType()))
      return Key.get(injectedType.getFieldType(injectedMember), annotation);
  return Key.get(injectedType.getFieldType(injectedMember));
}

代码示例来源:origin: mycila/guice

@Override
public Key<?> getKey(TypeLiteral<?> injectedType, Field injectedMember, A resourceAnnotation) {
  for (Annotation annotation : injectedMember.getAnnotations())
    if (Annotations.isBindingAnnotation(annotation.annotationType()))
      return Key.get(injectedType.getFieldType(injectedMember), annotation);
  return Key.get(injectedType.getFieldType(injectedMember));
}

代码示例来源:origin: mycila/guice

@Override
public Key<?> getKey(TypeLiteral<?> injectedType, Field injectedMember, A resourceAnnotation) {
  for (Annotation annotation : injectedMember.getAnnotations())
    if (Annotations.isBindingAnnotation(annotation.annotationType()))
      return Key.get(injectedType.getFieldType(injectedMember), annotation);
  return Key.get(injectedType.getFieldType(injectedMember));
}

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

/**
 * Returns the binding annotation on {@code member}, or null if there isn't one.
 */
public static Annotation findBindingAnnotation(
  Errors errors, Member member, Annotation[] annotations) {
 Annotation found = null;
 for (Annotation annotation : annotations) {
  Class<? extends Annotation> annotationType = annotation.annotationType();
  if (isBindingAnnotation(annotationType)) {
   if (found != null) {
    errors.duplicateBindingAnnotations(member, found.annotationType(), annotationType);
   } else {
    found = annotation;
   }
  }
 }
 return found;
}

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

/**
 * Returns the binding annotation on {@code member}, or null if there isn't one.
 */
public static Annotation findBindingAnnotation(
    Errors errors, Member member, Annotation[] annotations) {
  Annotation found = null;
  for (Annotation annotation : annotations) {
    Class<? extends Annotation> annotationType = annotation.annotationType();
    if (isBindingAnnotation(annotationType)) {
      if (found != null) {
        errors.duplicateBindingAnnotations(member, found.annotationType(), annotationType);
      } else {
        found = annotation;
      }
    }
  }
  return found;
}

代码示例来源:origin: spring-projects/spring-guice

private static Optional<Annotation> getAnnotationForBeanDefinition(BeanDefinition definition, ConfigurableListableBeanFactory beanFactory) {
  if (definition instanceof AnnotatedBeanDefinition
      && ((AnnotatedBeanDefinition) definition).getFactoryMethodMetadata() != null) {
    try {
      Method factoryMethod = getFactoryMethod(beanFactory, definition);
      return Arrays.stream(AnnotationUtils.getAnnotations(factoryMethod))
          .filter(a -> Annotations.isBindingAnnotation(a.annotationType())).findFirst();
    } catch (Exception e) {
      return Optional.empty();
    }
  } else {
    return Optional.empty();
  }
}

相关文章