本文整理了Java中org.hibernate.annotations.common.reflection.XAnnotatedElement
类的一些代码示例,展示了XAnnotatedElement
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XAnnotatedElement
类的具体详情如下:
包路径:org.hibernate.annotations.common.reflection.XAnnotatedElement
类名称:XAnnotatedElement
暂无
代码示例来源: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
if ( element.isAnnotationPresent( Id.class ) || element.isAnnotationPresent( EmbeddedId.class ) ) {
inFlightPropertyDataList.add( 0, propertyAnnotatedElement );
if ( element.isAnnotationPresent( Id.class ) && element.isAnnotationPresent( Column.class ) ) {
String columnName = element.getAnnotation( Column.class ).name();
for ( XProperty prop : declaringClass.getDeclaredProperties( AccessType.FIELD.getType() ) ) {
if ( !prop.isAnnotationPresent( MapsId.class ) ) {
if ( element.isAnnotationPresent( ManyToOne.class ) || element.isAnnotationPresent( OneToOne.class ) ) {
context.getMetadataCollector().addToOneAndIdProperty( entity, propertyAnnotatedElement );
inFlightPropertyDataList.add( propertyAnnotatedElement );
if ( element.isAnnotationPresent( MapsId.class ) ) {
context.getMetadataCollector().addPropertyAnnotatedWithMapsId( entity, propertyAnnotatedElement );
代码示例来源:origin: org.hibernate/hibernate-annotations
if ( element.isAnnotationPresent( Id.class ) || element.isAnnotationPresent( EmbeddedId.class ) ) {
annElts.add( 0, propertyAnnotatedElement );
if ( element.isAnnotationPresent( ManyToOne.class ) || element.isAnnotationPresent( OneToOne.class ) ) {
mappings.addToOneAndIdProperty( entity, propertyAnnotatedElement );
annElts.add( propertyAnnotatedElement );
if ( element.isAnnotationPresent( MapsId.class ) ) {
mappings.addPropertyAnnotatedWithMapsId( entity, propertyAnnotatedElement );
代码示例来源:origin: hibernate/hibernate-search
<A extends Annotation> Stream<A> getAnnotationsByType(XAnnotatedElement xAnnotated, Class<A> annotationType) {
return Arrays.stream( xAnnotated.getAnnotations() )
.flatMap( annotationHelper::expandRepeatableContainingAnnotation )
.filter( annotation -> annotationType.isAssignableFrom( annotation.annotationType() ) )
.map( annotationType::cast );
}
代码示例来源:origin: hibernate/hibernate-commons-annotations
public void testKnowsWhetherAnAnnotationIsPresent() {
assertTrue( getConcreteInstance().isAnnotationPresent( TestAnnotation.class ) );
assertFalse( getConcreteInstance().isAnnotationPresent( Override.class ) );
}
代码示例来源:origin: hibernate/hibernate-search
Stream<? extends Annotation> getAnnotationsByMetaAnnotationType(
XAnnotatedElement xAnnotated, Class<? extends Annotation> metaAnnotationType) {
return Arrays.stream( xAnnotated.getAnnotations() )
.flatMap( annotationHelper::expandRepeatableContainingAnnotation )
.filter( annotation -> annotationHelper.isMetaAnnotated( annotation, metaAnnotationType ) );
}
代码示例来源: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: org.hibernate/com.springsource.org.hibernate.core
if ( element.isAnnotationPresent( Id.class ) || element.isAnnotationPresent( EmbeddedId.class ) ) {
annElts.add( 0, propertyAnnotatedElement );
if ( element.isAnnotationPresent( Id.class ) && element.isAnnotationPresent( Column.class ) ) {
String columnName = element.getAnnotation( Column.class ).name();
for ( XProperty prop : declaringClass.getDeclaredProperties( AccessType.FIELD.getType() ) ) {
if ( prop.isAnnotationPresent( JoinColumn.class )
if ( element.isAnnotationPresent( ManyToOne.class ) || element.isAnnotationPresent( OneToOne.class ) ) {
mappings.addToOneAndIdProperty( entity, propertyAnnotatedElement );
annElts.add( propertyAnnotatedElement );
if ( element.isAnnotationPresent( MapsId.class ) ) {
mappings.addPropertyAnnotatedWithMapsId( entity, propertyAnnotatedElement );
代码示例来源: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: org.hibernate/com.springsource.org.hibernate
if ( element.isAnnotationPresent( Id.class ) || element.isAnnotationPresent( EmbeddedId.class ) ) {
annElts.add( 0, propertyAnnotatedElement );
if ( element.isAnnotationPresent( Id.class ) && element.isAnnotationPresent( Column.class ) ) {
String columnName = element.getAnnotation( Column.class ).name();
for ( XProperty prop : declaringClass.getDeclaredProperties( AccessType.FIELD.getType() ) ) {
if ( prop.isAnnotationPresent( JoinColumn.class )
if ( element.isAnnotationPresent( ManyToOne.class ) || element.isAnnotationPresent( OneToOne.class ) ) {
mappings.addToOneAndIdProperty( entity, propertyAnnotatedElement );
annElts.add( propertyAnnotatedElement );
if ( element.isAnnotationPresent( MapsId.class ) ) {
mappings.addPropertyAnnotatedWithMapsId( entity, propertyAnnotatedElement );
代码示例来源: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: org.hibernate.orm/hibernate-core
if ( element.isAnnotationPresent( Id.class ) || element.isAnnotationPresent( EmbeddedId.class ) ) {
inFlightPropertyDataList.add( 0, propertyAnnotatedElement );
if ( element.isAnnotationPresent( Id.class ) && element.isAnnotationPresent( Column.class ) ) {
String columnName = element.getAnnotation( Column.class ).name();
for ( XProperty prop : declaringClass.getDeclaredProperties( AccessType.FIELD.getType() ) ) {
if ( !prop.isAnnotationPresent( MapsId.class ) ) {
if ( element.isAnnotationPresent( ManyToOne.class ) || element.isAnnotationPresent( OneToOne.class ) ) {
context.getMetadataCollector().addToOneAndIdProperty( entity, propertyAnnotatedElement );
inFlightPropertyDataList.add( propertyAnnotatedElement );
if ( element.isAnnotationPresent( MapsId.class ) ) {
context.getMetadataCollector().addPropertyAnnotatedWithMapsId( entity, propertyAnnotatedElement );
代码示例来源: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 );
内容来源于网络,如有侵权,请联系作者删除!