java.lang.reflect.Constructor.getParameterAnnotations()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(126)

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

Constructor.getParameterAnnotations介绍

[英]Returns an array of arrays that represent the annotations of the formal parameters of this constructor. If there are no parameters on this constructor, then an empty array is returned. If there are no annotations set, then an array of empty arrays is returned.
[中]返回表示此构造函数形式参数注释的数组数组。如果此构造函数上没有参数,则返回空数组。如果未设置注释,则返回一个空数组数组。

代码示例

代码示例来源:origin: google/guava

@Override
final Annotation[][] getParameterAnnotations() {
 return constructor.getParameterAnnotations();
}

代码示例来源:origin: prestodb/presto

public  Annotation[][] getParameterAnnotations() {
    Annotation[][] result = _paramAnnotations;
    if (result == null) {
      result = _ctor.getParameterAnnotations();
      _paramAnnotations = result;
    }
    return result;
  }
}

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

public  Annotation[][] getParameterAnnotations() {
    Annotation[][] result = _paramAnnotations;
    if (result == null) {
      result = _ctor.getParameterAnnotations();
      _paramAnnotations = result;
    }
    return result;
  }
}

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

/**
   * {@inheritDoc}
   */
  public Annotation[][] getParameterAnnotations() {
    return constructor.getParameterAnnotations();
  }
}

代码示例来源:origin: prestodb/presto

@Override
final Annotation[][] getParameterAnnotations() {
 return constructor.getParameterAnnotations();
}

代码示例来源:origin: google/j2objc

@Override
final Annotation[][] getParameterAnnotations() {
 return constructor.getParameterAnnotations();
}

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

public Annotation[][] findParameterAnnotations(Constructor<?> constructor) {
    return constructor.getParameterAnnotations();
  }
};

代码示例来源:origin: ronmamo/reflections

private static Set<Annotation> parameterAnnotations(Member member) {
  Set<Annotation> result = Sets.newHashSet();
  Annotation[][] annotations =
      member instanceof Method ? ((Method) member).getParameterAnnotations() :
      member instanceof Constructor ? ((Constructor) member).getParameterAnnotations() : null;
  for (Annotation[] annotation : annotations) Collections.addAll(result, annotation);
  return result;
}

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

/**
   * {@inheritDoc}
   */
  @CachedReturnPlugin.Enhance("parameterAnnotations")
  public Annotation[][] getParameterAnnotations() {
    return constructor.getParameterAnnotations();
  }
}

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

public List<List<Annotation>> callConstructorGetParameterAnnotations(Constructor<?> m) {
  Annotation[][] array = m.getParameterAnnotations();
  List<List<Annotation>> result = new ArrayList<List<Annotation>>(array.length);
  for (int i = 0; i < array.length; i++) {
    result.add(Arrays.asList(array[i]));
  }
  return result;
}

代码示例来源:origin: org.reflections/reflections

private static Set<Annotation> parameterAnnotations(Member member) {
  Set<Annotation> result = Sets.newHashSet();
  Annotation[][] annotations =
      member instanceof Method ? ((Method) member).getParameterAnnotations() :
      member instanceof Constructor ? ((Constructor) member).getParameterAnnotations() : null;
  for (Annotation[] annotation : annotations) Collections.addAll(result, annotation);
  return result;
}

代码示例来源:origin: junit-team/junit4

public static List<ParameterSignature> signatures(Constructor<?> constructor) {
  return signatures(constructor.getParameterTypes(), constructor
      .getParameterAnnotations());
}

代码示例来源:origin: org.testng/testng

/**
 * Extracts constructor parameters.
 *
 * @param constructor any valid constructor.
 * @return extracted constructor parameters.
 */
public static Parameter[] getConstructorParameters(final Constructor constructor) {
 if (constructor == null) {
  return new Parameter[]{};
 }
 return getParameters(constructor.getParameterTypes(), constructor.getParameterAnnotations());
}

代码示例来源:origin: org.testng/testng

@Override
public String[] findOptionalValues(Constructor method) {
 return optionalValues(method.getParameterAnnotations());
}

代码示例来源:origin: google/j2objc

public static List<ParameterSignature> signatures(Constructor<?> constructor) {
  return signatures(constructor.getParameterTypes(), constructor
      .getParameterAnnotations());
}

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

InjectionPoint(TypeLiteral<?> declaringType, Constructor<?> constructor) {
 this.member = constructor;
 this.declaringType = declaringType;
 this.optional = false;
 this.dependencies =
   forMember(constructor, declaringType, constructor.getParameterAnnotations());
}

代码示例来源:origin: ronmamo/reflections

public List<String> getParameterAnnotationNames(Member method, int parameterIndex) {
  Annotation[][] annotations =
      method instanceof Method ? ((Method) method).getParameterAnnotations() :
      method instanceof Constructor ? ((Constructor) method).getParameterAnnotations() : null;
  return getAnnotationNames(annotations != null ? annotations[parameterIndex] : null);
}

代码示例来源:origin: lettuce-io/lettuce-core

@Override
public String[] getParameterNames(Constructor<?> ctor) {
  if (ctor.getParameterCount() == 0) {
    return new String[0];
  }
  return doGetParameterNames(ctor.getParameterAnnotations());
}

代码示例来源:origin: prestodb/presto

protected AnnotatedConstructor constructDefaultConstructor(ClassUtil.Ctor ctor,
    ClassUtil.Ctor mixin)
{
  if (_intr == null) { // when annotation processing is disabled
    return new AnnotatedConstructor(_typeContext, ctor.getConstructor(),
        _emptyAnnotationMap(), NO_ANNOTATION_MAPS);
  }
  return new AnnotatedConstructor(_typeContext, ctor.getConstructor(),
      collectAnnotations(ctor, mixin),
      collectAnnotations(ctor.getConstructor().getParameterAnnotations(),
          (mixin == null) ? null : mixin.getConstructor().getParameterAnnotations()));
}

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

protected AnnotatedConstructor constructDefaultConstructor(ClassUtil.Ctor ctor,
    ClassUtil.Ctor mixin)
{
  if (_intr == null) { // when annotation processing is disabled
    return new AnnotatedConstructor(_typeContext, ctor.getConstructor(),
        _emptyAnnotationMap(), NO_ANNOTATION_MAPS);
  }
  return new AnnotatedConstructor(_typeContext, ctor.getConstructor(),
      collectAnnotations(ctor, mixin),
      collectAnnotations(ctor.getConstructor().getParameterAnnotations(),
          (mixin == null) ? null : mixin.getConstructor().getParameterAnnotations()));
}

相关文章

微信公众号

最新文章

更多