io.baratine.inject.Key.qualifiers()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(135)

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

Key.qualifiers介绍

[英]Returns associated annotation types.
[中]返回关联的注释类型。

代码示例

代码示例来源:origin: baratine/baratine

/**
 * Returns an object producer.
 */
private <T> BindingAmp<T> findObjectBinding(Key<T> key)
{
 Objects.requireNonNull(key);
 if (key.qualifiers().length != 1) {
  throw new IllegalArgumentException();
 }
 return (BindingAmp) findBinding(Key.of(Object.class,
                     key.qualifiers()[0]));
}

代码示例来源:origin: baratine/baratine

/**
 * Builds Key from field's generic type and field's qualifying annotations.
 * A qualifying annotation is marked with a {@code @Qualifier}.
 *
 * @param field field for deriving type and annotation from
 * @param <T>   target type
 * @return instance of a Key
 */
public static <T> Key<T> of(Field field)
{
 return new Key(field.getGenericType(),
         qualifiers(field.getAnnotations()));
}

代码示例来源:origin: baratine/baratine

/**
 * Builds Key from method's generic return type and method's qualifying
 * annotations. A qualifying annotation is marked with a {@code @Qualifier}.
 *
 * @param method method for deriving return type and annotations from
 * @param <T>    target type
 * @return instance of a Key
 */
public static <T> Key<T> of(Method method)
{
 return new Key(method.getGenericReturnType(),
         qualifiers(method.getAnnotations()));
}

代码示例来源:origin: baratine/baratine

/**
 * Builds Key from constructor's declaring class and constructor's qualifying
 * annotations. A qualifying annotation is marked with a {@code @Qualifier}.
 *
 * @param ctor constructor for deriving type and annotations from
 * @param <T>  target type
 * @return instance of a Key
 */
public static <T> Key<T> of(Constructor ctor)
{
 return new Key(ctor.getDeclaringClass(),
         qualifiers(ctor.getAnnotations()));
}

代码示例来源:origin: baratine/baratine

/**
 * Builds Key from parameter's parameterized type and and qualifying annotations
 * found on the parameter and its declaring executable (e.g. Method)
 *
 * @param parameter parameter for deriving type and annotations from
 * @return instance of a key
 */
public static Key<?> of(Parameter parameter)
{
 return new Key(parameter.getParameterizedType(),
         qualifiers(parameter.getAnnotations(),
              parameter.getDeclaringExecutable().getAnnotations()));
}

相关文章

微信公众号

最新文章

更多