org.hibernate.annotations.common.reflection.XProperty.getAnnotations()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(123)

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

XProperty.getAnnotations介绍

暂无

代码示例

代码示例来源:origin: hibernate/hibernate-orm

: xProperty.getAnnotations();

代码示例来源:origin: hibernate/hibernate-orm

/**
 * Returns the value generation strategy for the given property, if any.
 */
private ValueGeneration getValueGenerationFromAnnotations(XProperty property) {
  AnnotationValueGeneration<?> valueGeneration = null;
  for ( Annotation annotation : property.getAnnotations() ) {
    AnnotationValueGeneration<?> candidate = getValueGenerationFromAnnotation( property, annotation );
    if ( candidate != null ) {
      if ( valueGeneration != null ) {
        throw new AnnotationException(
            "Only one generator annotation is allowed:" + StringHelper.qualify(
                holder.getPath(),
                name
            )
        );
      }
      else {
        valueGeneration = candidate;
      }
    }
  }
  return valueGeneration;
}

代码示例来源:origin: hibernate/hibernate-search

/**
 * Checks whether the specified class contains any locally-declared, Search-specific annotations.
 *
 * <p>This method will return {@code true} if such an annotation is detected
 * in the class itself, either applied directly on the class, on a field, or on a method.
 * <p>Only fields and methods declared by the specified class are taken into account:
 * inherited fields and methods are ignored.
 *
 * @param mappedClass the {@code XClass} to check for Search annotations
 *
 * @return Returns {@code true} if the class contains at least one Search annotation, {@code false} otherwise
 */
private static boolean containsLocalSearchAnnotation(XClass mappedClass) {
  // check the type annotations
  if ( containsSearchAnnotation( mappedClass.getAnnotations() ) ) {
    return true;
  }
  for ( XProperty method : mappedClass.getDeclaredProperties( XClass.ACCESS_PROPERTY ) ) {
    if ( containsSearchAnnotation( method.getAnnotations() ) ) {
      return true;
    }
  }
  for ( XProperty field : mappedClass.getDeclaredProperties( XClass.ACCESS_FIELD ) ) {
    if ( containsSearchAnnotation( field.getAnnotations() ) ) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

/**
 * Checks whether the specified class contains any locally-declared, Search-specific annotations.
 *
 * <p>This method will return {@code true} if such an annotation is detected
 * in the class itself, either applied directly on the class, on a field, or on a method.
 * <p>Only fields and methods declared by the specified class are taken into account:
 * inherited fields and methods are ignored.
 *
 * @param mappedClass the {@code XClass} to check for Search annotations
 *
 * @return Returns {@code true} if the class contains at least one Search annotation, {@code false} otherwise
 */
private static boolean containsLocalSearchAnnotation(XClass mappedClass) {
  // check the type annotations
  if ( containsSearchAnnotation( mappedClass.getAnnotations() ) ) {
    return true;
  }
  for ( XProperty method : mappedClass.getDeclaredProperties( XClass.ACCESS_PROPERTY ) ) {
    if ( containsSearchAnnotation( method.getAnnotations() ) ) {
      return true;
    }
  }
  for ( XProperty field : mappedClass.getDeclaredProperties( XClass.ACCESS_FIELD ) ) {
    if ( containsSearchAnnotation( field.getAnnotations() ) ) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.hibernate.orm/hibernate-core

/**
 * Returns the value generation strategy for the given property, if any.
 */
private ValueGeneration getValueGenerationFromAnnotations(XProperty property) {
  AnnotationValueGeneration<?> valueGeneration = null;
  for ( Annotation annotation : property.getAnnotations() ) {
    AnnotationValueGeneration<?> candidate = getValueGenerationFromAnnotation( property, annotation );
    if ( candidate != null ) {
      if ( valueGeneration != null ) {
        throw new AnnotationException(
            "Only one generator annotation is allowed:" + StringHelper.qualify(
                holder.getPath(),
                name
            )
        );
      }
      else {
        valueGeneration = candidate;
      }
    }
  }
  return valueGeneration;
}

相关文章