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

x33g5p2x  于2022-01-25 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(221)

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

Package.getDeclaredAnnotations介绍

[英]Returns an array of this package's declared annotations. Package annotations aren't inherited, so this is equivalent to #getAnnotations.
[中]返回此包声明的注释的数组。包注释不是继承的,因此这相当于#getAnnotations。

代码示例

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

/**
 * {@inheritDoc}
 */
public AnnotationList getDeclaredAnnotations() {
  return new AnnotationList.ForLoadedAnnotations(aPackage.getDeclaredAnnotations());
}

代码示例来源:origin: org.testifyproject.external/external-bytebuddy

@Override
public AnnotationList getDeclaredAnnotations() {
  return new AnnotationList.ForLoadedAnnotations(aPackage.getDeclaredAnnotations());
}

代码示例来源:origin: com.fitbur.external/external-bytebuddy

@Override
public AnnotationList getDeclaredAnnotations() {
  return new AnnotationList.ForLoadedAnnotations(aPackage.getDeclaredAnnotations());
}

代码示例来源:origin: org.eclipse/yasson

/**
 * Get a @JsonbVisibility annotation from a class or its package.
 * @param clazz Class to lookup annotation
 * @return Instantiated PropertyVisibilityStrategy if annotation is present
 */
public Optional<PropertyVisibilityStrategy> getPropertyVisibilityStrategy(Class<?> clazz) {
  JsonbVisibility visibilityAnnotation = findAnnotation(clazz.getDeclaredAnnotations(), JsonbVisibility.class);
  if ((visibilityAnnotation == null) && (clazz.getPackage() != null)) {
    visibilityAnnotation = findAnnotation(clazz.getPackage().getDeclaredAnnotations(), JsonbVisibility.class);
  }
  final Optional<JsonbVisibility> visibilityOptional = Optional.ofNullable(visibilityAnnotation);
  return visibilityOptional.map(jsonbVisibility -> ReflectionUtils.createNoArgConstructorInstance(jsonbVisibility.value()));
}

代码示例来源:origin: org.apache.openjpa/com.springsource.org.apache.openjpa

@Override
protected void parsePackageMappingAnnotations(Package pkg) {
  MappingTag tag;
  for (Annotation anno : pkg.getDeclaredAnnotations()) {
    tag = _tags.get(anno.annotationType());
    if (tag == null) {
      handleUnknownPackageMappingAnnotation(pkg, anno);
      continue;
    }
    switch (tag) {
      case TABLE_GEN:
        parseTableGenerator(pkg, (TableGenerator) anno);
        break;
      default:
        throw new UnsupportedException(_loc.get("unsupported", pkg,
          anno.toString()));
    }
  }
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

@Override
protected void parsePackageMappingAnnotations(Package pkg) {
  MappingTag tag;
  for (Annotation anno : pkg.getDeclaredAnnotations()) {
    tag = _tags.get(anno.annotationType());
    if (tag == null) {
      handleUnknownPackageMappingAnnotation(pkg, anno);
      continue;
    }
    switch (tag) {
      case TABLE_GEN:
        parseTableGenerator(pkg, (TableGenerator) anno);
        break;
      default:
        throw new UnsupportedException(_loc.get("unsupported", pkg,
          anno.toString()));
    }
  }
}

代码示例来源:origin: org.apache.openjpa/openjpa-persistence-jdbc

@Override
protected void parsePackageMappingAnnotations(Package pkg) {
  MappingTag tag;
  for (Annotation anno : pkg.getDeclaredAnnotations()) {
    tag = _tags.get(anno.annotationType());
    if (tag == null) {
      handleUnknownPackageMappingAnnotation(pkg, anno);
      continue;
    }
    switch (tag) {
      case TABLE_GEN:
        parseTableGenerator(pkg, (TableGenerator) anno);
        break;
      default:
        throw new UnsupportedException(_loc.get("unsupported", pkg,
          anno.toString()));
    }
  }
}

代码示例来源:origin: org.apache.openejb.patch/openjpa

@Override
protected void parsePackageMappingAnnotations(Package pkg) {
  MappingTag tag;
  for (Annotation anno : pkg.getDeclaredAnnotations()) {
    tag = _tags.get(anno.annotationType());
    if (tag == null) {
      handleUnknownPackageMappingAnnotation(pkg, anno);
      continue;
    }
    switch (tag) {
      case TABLE_GEN:
        parseTableGenerator(pkg, (TableGenerator) anno);
        break;
      default:
        throw new UnsupportedException(_loc.get("unsupported", pkg,
          anno.toString()));
    }
  }
}

代码示例来源:origin: org.apache.openjpa/com.springsource.org.apache.openjpa

for (Annotation anno : pkg.getDeclaredAnnotations()) {
  tag = _tags.get(anno.annotationType());
  if (tag == null) {

代码示例来源:origin: org.apache.openejb.patch/openjpa

for (Annotation anno : pkg.getDeclaredAnnotations()) {
  tag = _tags.get(anno.annotationType());
  if (tag == null) {

代码示例来源:origin: org.apache.openejb.patch/openjpa-persistence

for (Annotation anno : pkg.getDeclaredAnnotations()) {
  tag = _tags.get(anno.annotationType());
  if (tag == null) {

代码示例来源:origin: org.apache.openjpa/openjpa-persistence

for (Annotation anno : pkg.getDeclaredAnnotations()) {
  tag = _tags.get(anno.annotationType());
  if (tag == null) {

代码示例来源:origin: org.apache.openjpa/openjpa-all

for (Annotation anno : pkg.getDeclaredAnnotations()) {
  tag = _tags.get(anno.annotationType());
  if (tag == null) {

相关文章