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; }
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); } }
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 ); } } }
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 ); } } }
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 ); } } }
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 ); } } }
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 ); } } }
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 ) {
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 );
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() ); } }
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() );
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 );
String columnName = element.getAnnotation( Column.class ).name(); for ( XProperty prop : declaringClass.getDeclaredProperties( AccessType.FIELD.getType() ) ) { if ( !prop.isAnnotationPresent( MapsId.class ) ) {
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 ); } } }
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 ); } } }
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 ); } } }
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 ); } } }
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 ); } } }
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() ); } }
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() ); } }