Skip to content

Commit 79d98c2

Browse files
committed
more refactoring to ModelBinder
1 parent 7c61e20 commit 79d98c2

File tree

3 files changed

+500
-422
lines changed

3 files changed

+500
-422
lines changed

hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/AbstractEntitySourceImpl.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
import org.hibernate.internal.util.collections.CollectionHelper;
4242

4343
import static java.util.Collections.emptyMap;
44+
import static org.hibernate.internal.util.StringHelper.isNotEmpty;
45+
import static org.hibernate.internal.util.StringHelper.unqualify;
4446

4547
/**
4648
* @author Steve Ebersole
@@ -97,19 +99,20 @@ protected AbstractEntitySourceImpl(MappingDocument sourceMappingDocument, JaxbHb
9799
);
98100
}
99101

100-
public static EntityNamingSourceImpl extractEntityNamingSource(
102+
static EntityNamingSourceImpl extractEntityNamingSource(
101103
MappingDocument sourceMappingDocument,
102104
EntityInfo jaxbEntityMapping) {
103105
final String className = sourceMappingDocument.qualifyClassName( jaxbEntityMapping.getName() );
106+
final String mappingEntityName = jaxbEntityMapping.getEntityName();
104107
final String entityName;
105108
final String jpaEntityName;
106-
if ( StringHelper.isNotEmpty( jaxbEntityMapping.getEntityName() ) ) {
107-
entityName = jaxbEntityMapping.getEntityName();
108-
jpaEntityName = jaxbEntityMapping.getEntityName();
109+
if ( isNotEmpty( mappingEntityName ) ) {
110+
entityName = mappingEntityName;
111+
jpaEntityName = mappingEntityName;
109112
}
110113
else {
111114
entityName = className;
112-
jpaEntityName = StringHelper.unqualify( className );
115+
jpaEntityName = unqualify( className );
113116
}
114117
return new EntityNamingSourceImpl( entityName, className, jpaEntityName );
115118
}
@@ -122,7 +125,7 @@ private FilterSource[] buildFilterSources() {
122125
return NO_FILTER_SOURCES;
123126
}
124127

125-
FilterSource[] results = new FilterSource[size];
128+
final var results = new FilterSource[size];
126129
for ( int i = 0; i < size; i++ ) {
127130
JaxbHbmFilterType element = jaxbClassElement.getFilter().get( i );
128131
results[i] = new FilterSourceImpl( sourceMappingDocument(), element );

hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/EntityNamingSourceImpl.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
package org.hibernate.boot.model.source.internal.hbm;
66

77
import org.hibernate.boot.model.source.spi.EntityNamingSource;
8-
import org.hibernate.internal.util.StringHelper;
98
import org.hibernate.mapping.PersistentClass;
109

10+
import static org.hibernate.internal.util.StringHelper.isNotEmpty;
11+
1112
/**
1213
* Implementation of EntityNamingSource
1314
*
@@ -24,12 +25,13 @@ public EntityNamingSourceImpl(String entityName, String className, String jpaEnt
2425
this.entityName = entityName;
2526
this.className = className;
2627
this.jpaEntityName = jpaEntityName;
27-
28-
this.typeName = StringHelper.isNotEmpty( className ) ? className : entityName;
28+
this.typeName = isNotEmpty( className ) ? className : entityName;
2929
}
3030

3131
public EntityNamingSourceImpl(PersistentClass entityBinding) {
32-
this( entityBinding.getEntityName(), entityBinding.getClassName(), entityBinding.getJpaEntityName() );
32+
this( entityBinding.getEntityName(),
33+
entityBinding.getClassName(),
34+
entityBinding.getJpaEntityName() );
3335
}
3436

3537
@Override

0 commit comments

Comments
 (0)