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

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

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

XAnnotatedElement.getAnnotation介绍

暂无

代码示例

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

private static AssociationOverride[] buildAssociationOverrides(XAnnotatedElement element, String path) {
  AssociationOverride singleOverride = element.getAnnotation( AssociationOverride.class );
  AssociationOverrides pluralOverrides = element.getAnnotation( AssociationOverrides.class );
  AssociationOverride[] overrides;
  if ( singleOverride != null ) {
    overrides = new AssociationOverride[] { singleOverride };
  }
  else if ( pluralOverrides != null ) {
    overrides = pluralOverrides.value();
  }
  else {
    overrides = null;
  }
  return overrides;
}

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

private static void bindFilters(XAnnotatedElement annotatedElement, EntityBinder entityBinder) {
  Filters filtersAnn = annotatedElement.getAnnotation( Filters.class );
  if ( filtersAnn != null ) {
    for ( Filter filter : filtersAnn.value() ) {
      entityBinder.addFilter(filter);
    }
  }
  Filter filterAnn = annotatedElement.getAnnotation( Filter.class );
  if ( filterAnn != null ) {
    entityBinder.addFilter(filterAnn);
  }
}

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

private static void bindTypeDefs(XAnnotatedElement annotatedElement, MetadataBuildingContext context) {
  TypeDef defAnn = annotatedElement.getAnnotation( TypeDef.class );
  TypeDefs defsAnn = annotatedElement.getAnnotation( TypeDefs.class );
  if ( defAnn != null ) {
    bindTypeDef( defAnn, context );
  }
  if ( defsAnn != null ) {
    for ( TypeDef def : defsAnn.value() ) {
      bindTypeDef( def, context );
    }
  }
}

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

private static void bindFetchProfiles(XAnnotatedElement annotatedElement, MetadataBuildingContext context) {
  FetchProfile fetchProfileAnnotation = annotatedElement.getAnnotation( FetchProfile.class );
  FetchProfiles fetchProfileAnnotations = annotatedElement.getAnnotation( FetchProfiles.class );
  if ( fetchProfileAnnotation != null ) {
    bindFetchProfile( fetchProfileAnnotation, context );
  }
  if ( fetchProfileAnnotations != null ) {
    for ( FetchProfile profile : fetchProfileAnnotations.value() ) {
      bindFetchProfile( profile, context );
    }
  }
}

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

private static void bindGenericGenerators(XAnnotatedElement annotatedElement, MetadataBuildingContext context) {
  GenericGenerator defAnn = annotatedElement.getAnnotation( GenericGenerator.class );
  GenericGenerators defsAnn = annotatedElement.getAnnotation( GenericGenerators.class );
  if ( defAnn != null ) {
    bindGenericGenerator( defAnn, context );
  }
  if ( defsAnn != null ) {
    for ( GenericGenerator def : defsAnn.value() ) {
      bindGenericGenerator( def, context );
    }
  }
}

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

private static void bindFilterDefs(XAnnotatedElement annotatedElement, MetadataBuildingContext context) {
  FilterDef defAnn = annotatedElement.getAnnotation( FilterDef.class );
  FilterDefs defsAnn = annotatedElement.getAnnotation( FilterDefs.class );
  if ( defAnn != null ) {
    bindFilterDef( defAnn, context );
  }
  if ( defsAnn != null ) {
    for ( FilterDef def : defsAnn.value() ) {
      bindFilterDef( def, context );
    }
  }
}

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

public static void bindAnyMetaDefs(XAnnotatedElement annotatedElement, MetadataBuildingContext context) {
  AnyMetaDef defAnn = annotatedElement.getAnnotation( AnyMetaDef.class );
  AnyMetaDefs defsAnn = annotatedElement.getAnnotation( AnyMetaDefs.class );
  boolean mustHaveName = XClass.class.isAssignableFrom( annotatedElement.getClass() )
      || XPackage.class.isAssignableFrom( annotatedElement.getClass() );
  if ( defAnn != null ) {
    checkAnyMetaDefValidity( mustHaveName, defAnn, annotatedElement );
    bindAnyMetaDef( defAnn, context );
  }
  if ( defsAnn != null ) {
    for (AnyMetaDef def : defsAnn.value()) {
      checkAnyMetaDefValidity( mustHaveName, def, annotatedElement );
      bindAnyMetaDef( def, context );
    }
  }
}

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

private static Map<String, Column[]> buildColumnOverride(XAnnotatedElement element, String path) {
  Map<String, Column[]> columnOverride = new HashMap<String, Column[]>();
  if ( element != null ) {
    AttributeOverride singleOverride = element.getAnnotation( AttributeOverride.class );
    AttributeOverrides multipleOverrides = element.getAnnotation( AttributeOverrides.class );
    AttributeOverride[] overrides;
    if ( singleOverride != null ) {

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

SqlResultSetMapping ann = annotatedElement.getAnnotation( SqlResultSetMapping.class );
QueryBinder.bindSqlResultSetMapping( ann, context, false );
SqlResultSetMappings ann = annotatedElement.getAnnotation( SqlResultSetMappings.class );
if ( ann != null ) {
  for ( SqlResultSetMapping current : ann.value() ) {
NamedQuery ann = annotatedElement.getAnnotation( NamedQuery.class );
QueryBinder.bindQuery( ann, context, false );
org.hibernate.annotations.NamedQuery ann = annotatedElement.getAnnotation(
    org.hibernate.annotations.NamedQuery.class
);
NamedQueries ann = annotatedElement.getAnnotation( NamedQueries.class );
QueryBinder.bindQueries( ann, context, false );
org.hibernate.annotations.NamedQueries ann = annotatedElement.getAnnotation(
    org.hibernate.annotations.NamedQueries.class
);
NamedNativeQuery ann = annotatedElement.getAnnotation( NamedNativeQuery.class );
QueryBinder.bindNativeQuery( ann, context, false );
org.hibernate.annotations.NamedNativeQuery ann = annotatedElement.getAnnotation(
    org.hibernate.annotations.NamedNativeQuery.class
);
NamedNativeQueries ann = annotatedElement.getAnnotation( NamedNativeQueries.class );

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

private void extractInheritanceType() {
  XAnnotatedElement element = getClazz();
  Inheritance inhAnn = element.getAnnotation( Inheritance.class );
  MappedSuperclass mappedSuperClass = element.getAnnotation( MappedSuperclass.class );
  if ( mappedSuperClass != null ) {
    setEmbeddableSuperclass( true );
    setType( inhAnn == null ? null : inhAnn.strategy() );
  }
  else {
    setType( inhAnn == null ? InheritanceType.SINGLE_TABLE : inhAnn.strategy() );
  }
}

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

AccessType jpaAccessType = null;
org.hibernate.annotations.AccessType accessTypeAnnotation = element.getAnnotation( org.hibernate.annotations.AccessType.class );
if ( accessTypeAnnotation != null ) {
  hibernateAccessType = AccessType.getAccessStrategy( accessTypeAnnotation.value() );
Access access = element.getAnnotation( Access.class );
if ( access != null ) {
  jpaAccessType = AccessType.getAccessStrategy( access.value() );

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

HashMap<String, IdentifierGeneratorDefinition> generators = new HashMap<>();
TableGenerators tableGenerators = annElt.getAnnotation( TableGenerators.class );
if ( tableGenerators != null ) {
  for ( TableGenerator tableGenerator : tableGenerators.value() ) {
SequenceGenerators sequenceGenerators = annElt.getAnnotation( SequenceGenerators.class );
if ( sequenceGenerators != null ) {
  for ( SequenceGenerator sequenceGenerator : sequenceGenerators.value() ) {
TableGenerator tabGen = annElt.getAnnotation( TableGenerator.class );
SequenceGenerator seqGen = annElt.getAnnotation( SequenceGenerator.class );
GenericGenerator genGen = annElt.getAnnotation( GenericGenerator.class );
if ( tabGen != null ) {
  IdentifierGeneratorDefinition idGen = buildIdGenerator( tabGen, context );

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

String columnName = element.getAnnotation( Column.class ).name();
for ( XProperty prop : declaringClass.getDeclaredProperties( AccessType.FIELD.getType() ) ) {
  if ( !prop.isAnnotationPresent( MapsId.class ) ) {

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

private static void bindTypeDefs(XAnnotatedElement annotatedElement, ExtendedMappings mappings) {
  TypeDef defAnn = annotatedElement.getAnnotation( TypeDef.class );
  TypeDefs defsAnn = annotatedElement.getAnnotation( TypeDefs.class );
  if ( defAnn != null ) {
    bindTypeDef( defAnn, mappings );
  }
  if ( defsAnn != null ) {
    for ( TypeDef def : defsAnn.value() ) {
      bindTypeDef( def, mappings );
    }
  }
}

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

private static void bindFilterDefs(XAnnotatedElement annotatedElement, ExtendedMappings mappings) {
  FilterDef defAnn = annotatedElement.getAnnotation( FilterDef.class );
  FilterDefs defsAnn = annotatedElement.getAnnotation( FilterDefs.class );
  if ( defAnn != null ) {
    bindFilterDef( defAnn, mappings );
  }
  if ( defsAnn != null ) {
    for ( FilterDef def : defsAnn.value() ) {
      bindFilterDef( def, mappings );
    }
  }
}

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

private static void bindFetchProfiles(XAnnotatedElement annotatedElement, ExtendedMappings mappings) {
  FetchProfile fetchProfileAnnotation = annotatedElement.getAnnotation( FetchProfile.class );
  FetchProfiles fetchProfileAnnotations = annotatedElement.getAnnotation( FetchProfiles.class );
  if ( fetchProfileAnnotation != null ) {
    bindFetchProfile( fetchProfileAnnotation, mappings );
  }
  if ( fetchProfileAnnotations != null ) {
    for ( FetchProfile profile : fetchProfileAnnotations.value() ) {
      bindFetchProfile( profile, mappings );
    }
  }
}

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

private static void bindGenericGenerators(XAnnotatedElement annotatedElement, ExtendedMappings mappings) {
  GenericGenerator defAnn = annotatedElement.getAnnotation( GenericGenerator.class );
  GenericGenerators defsAnn = annotatedElement.getAnnotation( GenericGenerators.class );
  if ( defAnn != null ) {
    bindGenericGenerator( defAnn, mappings );
  }
  if ( defsAnn != null ) {
    for ( GenericGenerator def : defsAnn.value() ) {
      bindGenericGenerator( def, mappings );
    }
  }
}

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

public static void bindAnyMetaDefs(XAnnotatedElement annotatedElement, ExtendedMappings mappings) {
  AnyMetaDef defAnn = annotatedElement.getAnnotation( AnyMetaDef.class );
  AnyMetaDefs defsAnn = annotatedElement.getAnnotation( AnyMetaDefs.class );
  boolean mustHaveName = XClass.class.isAssignableFrom( annotatedElement.getClass() )
      || XPackage.class.isAssignableFrom( annotatedElement.getClass() );
  if ( defAnn != null ) {
    checkAnyMetaDefValidity( mustHaveName, defAnn, annotatedElement );
    bindAnyMetaDef( defAnn, mappings );
  }
  if ( defsAnn != null ) {
    for (AnyMetaDef def : defsAnn.value()) {
      checkAnyMetaDefValidity( mustHaveName, def, annotatedElement );
      bindAnyMetaDef( def, mappings );
    }
  }
}

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

private void extractInheritanceType() {
  XAnnotatedElement element = getClazz();
  Inheritance inhAnn = element.getAnnotation( Inheritance.class );
  MappedSuperclass mappedSuperClass = element.getAnnotation( MappedSuperclass.class );
  if ( mappedSuperClass != null ) {
    setEmbeddableSuperclass( true );
    setType( inhAnn == null ? null : inhAnn.strategy() );
  }
  else {
    setType( inhAnn == null ? InheritanceType.SINGLE_TABLE : inhAnn.strategy() );
  }
}

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

private static void bindFilters(XAnnotatedElement annotatedElement, EntityBinder entityBinder) {
  Filters filtersAnn = annotatedElement.getAnnotation( Filters.class );
  if ( filtersAnn != null ) {
    for ( Filter filter : filtersAnn.value() ) {
      entityBinder.addFilter( filter.name(), filter.condition() );
    }
  }
  Filter filterAnn = annotatedElement.getAnnotation( Filter.class );
  if ( filterAnn != null ) {
    entityBinder.addFilter( filterAnn.name(), filterAnn.condition() );
  }
}

相关文章