clean up unused instance variables

This commit is contained in:
Gavin King 2024-11-14 10:40:27 +01:00
parent 12e17ed870
commit 5d5ce3feda
2 changed files with 5 additions and 27 deletions

View File

@ -5,13 +5,10 @@
package org.hibernate.boot.jaxb.hbm.transform;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.hibernate.MappingException;
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmHibernateMapping;
import org.hibernate.boot.jaxb.spi.Binding;
import org.hibernate.boot.spi.MetadataImplementor;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Component;
@ -21,7 +18,6 @@ import org.hibernate.mapping.Property;
import org.hibernate.mapping.RootClass;
import org.hibernate.mapping.Table;
import org.hibernate.mapping.ToOne;
import org.hibernate.service.ServiceRegistry;
/**
* @author Steve Ebersole
@ -29,25 +25,20 @@ import org.hibernate.service.ServiceRegistry;
public class BootModelPreprocessor {
private static final Map<String,String> entityByNameMap = new HashMap<>();
static void preprocessBooModel(
List<Binding<JaxbHbmHibernateMapping>> hbmXmlBindings,
MetadataImplementor bootModel,
ServiceRegistry serviceRegistry,
TransformationState transformationState) {
static void preprocessBooModel(MetadataImplementor bootModel, TransformationState transformationState) {
entityByNameMap.clear();
bootModel.getEntityBindings().forEach( (persistentClass) -> {
final Table table = TransformationHelper.determineEntityTable( persistentClass );
final EntityTypeInfo entityTypeInfo = new EntityTypeInfo( table, persistentClass );
transformationState.getEntityInfoByName().put( persistentClass.getEntityName(), entityTypeInfo );
buildPersistentClassPropertyInfos( persistentClass, entityTypeInfo, bootModel, transformationState );
buildPersistentClassPropertyInfos( persistentClass, entityTypeInfo, transformationState );
} );
}
private static void buildPersistentClassPropertyInfos(
PersistentClass persistentClass,
EntityTypeInfo entityTypeInfo,
MetadataImplementor bootModel,
TransformationState transformationState) {
if ( persistentClass.getClassName() != null ) {
final String previous = entityByNameMap.put( persistentClass.getClassName(), persistentClass.getEntityName() );

View File

@ -231,12 +231,7 @@ public class HbmXmlTransformer {
final List<Binding<JaxbEntityMappingsImpl>> transformations = XmlPreprocessor.preprocessHbmXml( hbmXmlBindings, transformationState );
// build and perform a pass over the boot model building the rest of the transformation-state
BootModelPreprocessor.preprocessBooModel(
hbmXmlBindings,
bootModel,
serviceRegistry,
transformationState
);
BootModelPreprocessor.preprocessBooModel( bootModel, transformationState );
// now we are ready to fully build the mapping.xml transformations
for ( int i = 0; i < hbmXmlBindings.size(); i++ ) {
@ -244,9 +239,7 @@ public class HbmXmlTransformer {
hbmXmlBindings.get( i ),
transformations.get( i ),
transformationState,
bootModel,
unsupportedFeatureHandling,
serviceRegistry
unsupportedFeatureHandling
);
hbmXmlTransformer.performTransformation();
@ -260,10 +253,8 @@ public class HbmXmlTransformer {
private final Binding<JaxbEntityMappingsImpl> mappingXmlBinding;
private final TransformationState transformationState;
private final MetadataImplementor bootModel;
private final UnsupportedFeatureHandling unsupportedFeatureHandling;
private final ServiceRegistry serviceRegistry;
// todo (7.0) : use transformation-state instead
private final Map<String,JaxbEmbeddableImpl> jaxbEmbeddableByClassName = new HashMap<>();
@ -274,15 +265,11 @@ public class HbmXmlTransformer {
Binding<JaxbHbmHibernateMapping> hbmXmlBinding,
Binding<JaxbEntityMappingsImpl> mappingXmlBinding,
TransformationState transformationState,
MetadataImplementor bootModel,
UnsupportedFeatureHandling unsupportedFeatureHandling,
ServiceRegistry serviceRegistry) {
UnsupportedFeatureHandling unsupportedFeatureHandling) {
this.hbmXmlBinding = hbmXmlBinding;
this.mappingXmlBinding = mappingXmlBinding;
this.transformationState = transformationState;
this.bootModel = bootModel;
this.unsupportedFeatureHandling = unsupportedFeatureHandling;
this.serviceRegistry = serviceRegistry;
}