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

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

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

Constructor.getDeclaredAnnotations介绍

暂无

代码示例

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

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

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

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

代码示例来源:origin: oldmanpushcart/greys-anatomy

@Override
public Annotation[] getDeclaredAnnotations() {
  return target.getDeclaredAnnotations();
}

代码示例来源:origin: alibaba/jvm-sandbox

@Override
public Annotation[] getDeclaredAnnotations() {
  return target.getDeclaredAnnotations();
}

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

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

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

public List<Annotation> callConstructorGetDeclaredAnnotations(Constructor<?> m) {
  return Arrays.asList(m.getDeclaredAnnotations());
}
public boolean callConstructorIsAnnotationPresent(Constructor<?> m, Class<? extends Annotation> annotClass) {

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

public List<String> getMethodAnnotationNames(Member method) {
  Annotation[] annotations =
      method instanceof Method ? ((Method) method).getDeclaredAnnotations() :
      method instanceof Constructor ? ((Constructor) method).getDeclaredAnnotations() : null;
  return getAnnotationNames(annotations);
}

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

public List<String> getMethodAnnotationNames(Member method) {
  Annotation[] annotations =
      method instanceof Method ? ((Method) method).getDeclaredAnnotations() :
      method instanceof Constructor ? ((Constructor) method).getDeclaredAnnotations() : null;
  return getAnnotationNames(annotations);
}

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

/**
 * {@inheritDoc}
 */
@CachedReturnPlugin.Enhance("declaredAnnotations")
public AnnotationList getDeclaredAnnotations() {
  return new AnnotationList.ForLoadedAnnotations(constructor.getDeclaredAnnotations());
}

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

private AnnotationMap collectAnnotations(ClassUtil.Ctor main, ClassUtil.Ctor mixin) {
  AnnotationCollector c = collectAnnotations(main.getConstructor().getDeclaredAnnotations());
  if (mixin != null) {
    c = collectAnnotations(c, mixin.getConstructor().getDeclaredAnnotations());
  }
  return c.asAnnotationMap();
}

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

private AnnotationMap collectAnnotations(ClassUtil.Ctor main, ClassUtil.Ctor mixin) {
  AnnotationCollector c = collectAnnotations(main.getConstructor().getDeclaredAnnotations());
  if (mixin != null) {
    c = collectAnnotations(c, mixin.getConstructor().getDeclaredAnnotations());
  }
  return c.asAnnotationMap();
}

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

private AnnotationMap collectAnnotations(ClassUtil.Ctor main, ClassUtil.Ctor mixin) {
  AnnotationCollector c = collectAnnotations(main.getConstructor().getDeclaredAnnotations());
  if (mixin != null) {
    c = collectAnnotations(c, mixin.getConstructor().getDeclaredAnnotations());
  }
  return c.asAnnotationMap();
}

代码示例来源:origin: swagger-api/swagger-core

&& !ReflectionUtils.isInject(Arrays.asList(constructor.getDeclaredAnnotations()))) {
continue;

代码示例来源:origin: org.codehaus.jackson/jackson-mapper-asl

/**
 * @param addParamAnnotations Whether parameter annotations are to be
 *   added as well
 */
protected void _addMixOvers(Constructor<?> mixin, AnnotatedConstructor target,
    boolean addParamAnnotations)
{
  for (Annotation a : mixin.getDeclaredAnnotations()) {
    if (_annotationIntrospector.isHandled(a)) {
      target.addOrOverride(a);
    }
  }
  if (addParamAnnotations) {
    Annotation[][] pa = mixin.getParameterAnnotations();
    for (int i = 0, len = pa.length; i < len; ++i) {
      for (Annotation a : pa[i]) {
        target.addOrOverrideParam(i, a);
      }
    }
  }
}

代码示例来源:origin: org.codehaus.jackson/jackson-mapper-asl

return new AnnotatedConstructor(ctor, _collectRelevantAnnotations(ctor.getDeclaredAnnotations()), null);
  resolvedAnnotations = _collectRelevantAnnotations(paramAnns);
return new AnnotatedConstructor(ctor, _collectRelevantAnnotations(ctor.getDeclaredAnnotations()),
    resolvedAnnotations);

代码示例来源:origin: alibaba/jvm-sandbox

private BehaviorStructure newBehaviorStructure(final Constructor constructor) {
  return new BehaviorStructure(
      new AccessImplByJDKBehavior(constructor),
      "<init>",
      this,
      this,
      newInstances(constructor.getParameterTypes()),
      newInstances(constructor.getExceptionTypes()),
      newInstances(getAnnotationTypeArray(constructor.getDeclaredAnnotations()))
  );
}

代码示例来源:origin: org.mongodb/mongo-java-driver

for (Constructor<?> constructor : clazz.getDeclaredConstructors()) {
  if (isPublic(constructor.getModifiers()) && !constructor.isSynthetic()) {
    for (Annotation annotation : constructor.getDeclaredAnnotations()) {
      if (annotation.annotationType().equals(BsonCreator.class)) {
        if (creatorExecutable != null) {

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * @param addParamAnnotations Whether parameter annotations are to be
 *   added as well
 */
protected void _addMixOvers(Constructor<?> mixin, AnnotatedConstructor target,
    boolean addParamAnnotations)
{
  for (Annotation a : mixin.getDeclaredAnnotations()) {
    if (_annotationIntrospector.isHandled(a)) {
      target.addOrOverride(a);
    }
  }
  if (addParamAnnotations) {
    Annotation[][] pa = mixin.getParameterAnnotations();
    for (int i = 0, len = pa.length; i < len; ++i) {
      for (Annotation a : pa[i]) {
        target.addOrOverrideParam(i, a);
      }
    }
  }
}

代码示例来源:origin: camunda/camunda-bpm-platform

return new AnnotatedConstructor(ctor, _collectRelevantAnnotations(ctor.getDeclaredAnnotations()), null);
  resolvedAnnotations = _collectRelevantAnnotations(paramAnns);
return new AnnotatedConstructor(ctor, _collectRelevantAnnotations(ctor.getDeclaredAnnotations()),
    resolvedAnnotations);

代码示例来源:origin: INRIA/spoon

@Override
public <T> void visitConstructor(Constructor<T> constructor) {
  for (Annotation annotation : constructor.getDeclaredAnnotations()) {
    visitAnnotation(annotation);
  }
  int nrEnclosingClasses = getNumberOfEnclosingClasses(constructor.getDeclaringClass());
  for (RtParameter parameter : RtParameter.parametersOf(constructor)) {
    //ignore implicit parameters of enclosing classes
    if (nrEnclosingClasses > 0) {
      nrEnclosingClasses--;
      continue;
    }
    visitParameter(parameter);
  }
  for (TypeVariable<Constructor<T>> aTypeParameter : constructor.getTypeParameters()) {
    visitTypeParameter(aTypeParameter);
  }
  for (Class<?> exceptionType : constructor.getExceptionTypes()) {
    visitTypeReference(CtRole.THROWN, exceptionType);
  }
}

相关文章

微信公众号

最新文章

更多