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

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

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

Annotations.findBindingAnnotation介绍

[英]Returns the binding annotation on member, or null if there isn't one.
[中]返回成员上的绑定批注,如果没有,则返回null。

代码示例

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

<T> Key<T> getKey(Errors errors, TypeLiteral<T> type, Member member, Annotation[] annotations) {
 Annotation bindingAnnotation = Annotations.findBindingAnnotation(errors, member, annotations);
 return bindingAnnotation == null ? Key.get(type) : Key.get(type, bindingAnnotation);
}

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

/** Gets a key for the given type, member and annotations. */
public static Key<?> getKey(
  TypeLiteral<?> type, Member member, Annotation[] annotations, Errors errors)
  throws ErrorsException {
 int numErrorsBefore = errors.size();
 Annotation found = findBindingAnnotation(errors, member, annotations);
 errors.throwIfNewErrors(numErrorsBefore);
 return found == null ? Key.get(type) : Key.get(type, found);
}

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

/** Returns true if the binding annotation is in the wrong place. */
private static boolean checkForMisplacedBindingAnnotations(Member member, Errors errors) {
 Annotation misplacedBindingAnnotation =
   Annotations.findBindingAnnotation(
     errors, member, ((AnnotatedElement) member).getAnnotations());
 if (misplacedBindingAnnotation == null) {
  return false;
 }
 // don't warn about misplaced binding annotations on methods when there's a field with the same
 // name. In Scala, fields always get accessor methods (that we need to ignore). See bug 242.
 if (member instanceof Method) {
  try {
   if (member.getDeclaringClass().getDeclaredField(member.getName()) != null) {
    return false;
   }
  } catch (NoSuchFieldException ignore) {
  }
 }
 errors.misplacedBindingAnnotation(member, misplacedBindingAnnotation);
 return true;
}

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

<T> Key<T> getKey(Errors errors, TypeLiteral<T> type, Member member, Annotation[] annotations) {
 Annotation bindingAnnotation = Annotations.findBindingAnnotation(errors, member, annotations);
 return bindingAnnotation == null ? Key.get(type) : Key.get(type, bindingAnnotation);
}

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

<T> Key<T> getKey(Errors errors, TypeLiteral<T> type, Member member, Annotation[] annotations) {
  Annotation bindingAnnotation = Annotations.findBindingAnnotation(errors, member, annotations);
  return bindingAnnotation == null ? Key.get(type) : Key.get(type, bindingAnnotation);
}

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

<T> Key<T> getKey(Errors errors, TypeLiteral<T> type, Member member, Annotation[] annotations) {
 Annotation bindingAnnotation = Annotations.findBindingAnnotation(errors, member, annotations);
 return bindingAnnotation == null ? Key.get(type) : Key.get(type, bindingAnnotation);
}

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

<T> Key<T> getKey(Errors errors, TypeLiteral<T> type, Member member, Annotation[] annotations) {
 Annotation bindingAnnotation = Annotations.findBindingAnnotation(errors, member, annotations);
 return bindingAnnotation == null ? Key.get(type) : Key.get(type, bindingAnnotation);
}

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

<T> Key<T> getKey(Errors errors, TypeLiteral<T> type, Member member, Annotation[] annotations) {
 Annotation bindingAnnotation = Annotations.findBindingAnnotation(errors, member, annotations);
 return bindingAnnotation == null ? Key.get(type) : Key.get(type, bindingAnnotation);
}

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

<T> Key<T> getKey(Errors errors, TypeLiteral<T> type, Member member, Annotation[] annotations) {
 Annotation bindingAnnotation = Annotations.findBindingAnnotation(errors, member, annotations);
 return bindingAnnotation == null ? Key.get(type) : Key.get(type, bindingAnnotation);
}

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

<T> Key<T> getKey(Errors errors, TypeLiteral<T> type, Member member, Annotation[] annotations) {
 Annotation bindingAnnotation = Annotations.findBindingAnnotation(errors, member, annotations);
 return bindingAnnotation == null ? Key.get(type) : Key.get(type, bindingAnnotation);
}

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

/**
 * Returns true if the binding annotation is in the wrong place.
 */
private static boolean checkForMisplacedBindingAnnotations(Member member, Errors errors) {
 Annotation misplacedBindingAnnotation = Annotations.findBindingAnnotation(
   errors, member, ((AnnotatedElement) member).getAnnotations());
 if (misplacedBindingAnnotation == null) {
  return false;
 }
 // don't warn about misplaced binding annotations on methods when there's a field with the same
 // name. In Scala, fields always get accessor methods (that we need to ignore). See bug 242.
 if (member instanceof Method) {
  try {
   if (member.getDeclaringClass().getDeclaredField(member.getName()) != null) {
    return false;
   }
  } catch (NoSuchFieldException ignore) {
  }
 }
 errors.misplacedBindingAnnotation(member, misplacedBindingAnnotation);
 return true;
}

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

/** Gets a key for the given type, member and annotations. */
public static Key<?> getKey(
  TypeLiteral<?> type, Member member, Annotation[] annotations, Errors errors)
  throws ErrorsException {
 int numErrorsBefore = errors.size();
 Annotation found = findBindingAnnotation(errors, member, annotations);
 errors.throwIfNewErrors(numErrorsBefore);
 return found == null ? Key.get(type) : Key.get(type, found);
}

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

/**
 * Gets a key for the given type, member and annotations.
 */
public static Key<?> getKey(TypeLiteral<?> type, Member member, Annotation[] annotations,
              Errors errors) throws ErrorsException {
  int numErrorsBefore = errors.size();
  Annotation found = findBindingAnnotation(errors, member, annotations);
  errors.throwIfNewErrors(numErrorsBefore);
  return found == null ? Key.get(type) : Key.get(type, found);
}

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

/** Gets a key for the given type, member and annotations. */
public static Key<?> getKey(TypeLiteral<?> type, Member member, Annotation[] annotations,
  Errors errors) throws ErrorsException {
 int numErrorsBefore = errors.size();
 Annotation found = findBindingAnnotation(errors, member, annotations);
 errors.throwIfNewErrors(numErrorsBefore);
 return found == null ? Key.get(type) : Key.get(type, found);
}

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

/** Gets a key for the given type, member and annotations. */
public static Key<?> getKey(TypeLiteral<?> type, Member member, Annotation[] annotations,
  Errors errors) throws ErrorsException {
 int numErrorsBefore = errors.size();
 Annotation found = findBindingAnnotation(errors, member, annotations);
 errors.throwIfNewErrors(numErrorsBefore);
 return found == null ? Key.get(type) : Key.get(type, found);
}

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

/**
 * Returns true if the binding annotation is in the wrong place.
 */
private static boolean checkForMisplacedBindingAnnotations(Member member, Errors errors) {
 Annotation misplacedBindingAnnotation = Annotations.findBindingAnnotation(
   errors, member, ((AnnotatedElement) member).getAnnotations());
 if (misplacedBindingAnnotation == null) {
  return false;
 }
 // don't warn about misplaced binding annotations on methods when there's a field with the same
 // name. In Scala, fields always get accessor methods (that we need to ignore). See bug 242.
 if (member instanceof Method) {
  try {
   if (member.getDeclaringClass().getDeclaredField(member.getName()) != null) {
    return false;
   }
  } catch (NoSuchFieldException ignore) {
  }
 }
 errors.misplacedBindingAnnotation(member, misplacedBindingAnnotation);
 return true;
}

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

/**
 * Returns true if the binding annotation is in the wrong place.
 */
private static boolean checkForMisplacedBindingAnnotations(Member member, Errors errors) {
  Annotation misplacedBindingAnnotation = Annotations.findBindingAnnotation(
      errors, member, ((AnnotatedElement) member).getAnnotations());
  if (misplacedBindingAnnotation == null) {
    return false;
  }
  // don't warn about misplaced binding annotations on methods when there's a field with the same
  // name. In Scala, fields always get accessor methods (that we need to ignore). See bug 242.
  if (member instanceof Method) {
    try {
      if (member.getDeclaringClass().getDeclaredField(member.getName()) != null) {
        return false;
      }
    } catch (NoSuchFieldException ignore) {
    }
  }
  errors.misplacedBindingAnnotation(member, misplacedBindingAnnotation);
  return true;
}

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

/** Gets a key for the given type, member and annotations. */
public static Key<?> getKey(
  TypeLiteral<?> type, Member member, Annotation[] annotations, Errors errors)
  throws ErrorsException {
 int numErrorsBefore = errors.size();
 Annotation found = findBindingAnnotation(errors, member, annotations);
 errors.throwIfNewErrors(numErrorsBefore);
 return found == null ? Key.get(type) : Key.get(type, found);
}

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

/** Gets a key for the given type, member and annotations. */
public static Key<?> getKey(TypeLiteral<?> type, Member member, Annotation[] annotations,
  Errors errors) throws ErrorsException {
 int numErrorsBefore = errors.size();
 Annotation found = findBindingAnnotation(errors, member, annotations);
 errors.throwIfNewErrors(numErrorsBefore);
 return found == null ? Key.get(type) : Key.get(type, found);
}

代码示例来源:origin: org.immutables/common

Dependency<ListenableFuture<?>> extractDependency(Errors methodErrors, Parameter parameter) {
 @Nullable
 Annotation bindingAnnotation =
   Annotations.findBindingAnnotation(
     methodErrors,
     parameter.getDeclaringInvokable(),
     parameter.getAnnotations());
 return Dependency.get(futureKey(
   parameter.getType(),
   bindingAnnotation));
}

相关文章