org.hibernate.testing.boot.MetadataBuildingContextTestingImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-testing-jakarta Show documentation
Show all versions of hibernate-testing-jakarta Show documentation
Support for testing Hibernate ORM Jakarta functionality
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or .
*/
package org.hibernate.testing.boot;
import org.hibernate.boot.internal.BootstrapContextImpl;
import org.hibernate.boot.internal.InFlightMetadataCollectorImpl;
import org.hibernate.boot.internal.MetadataBuilderImpl;
import org.hibernate.boot.model.naming.ObjectNameNormalizer;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.boot.spi.BootstrapContext;
import org.hibernate.boot.spi.ClassLoaderAccess;
import org.hibernate.boot.spi.InFlightMetadataCollector;
import org.hibernate.boot.spi.MappingDefaults;
import org.hibernate.boot.spi.MetadataBuildingContext;
import org.hibernate.boot.spi.MetadataBuildingOptions;
import org.hibernate.type.TypeResolver;
/**
* @author Steve Ebersole
*/
public class MetadataBuildingContextTestingImpl implements MetadataBuildingContext {
private final MetadataBuildingOptions buildingOptions;
private final MappingDefaults mappingDefaults;
private final InFlightMetadataCollector metadataCollector;
private final BootstrapContext bootstrapContext;
private final ObjectNameNormalizer objectNameNormalizer;
public MetadataBuildingContextTestingImpl(StandardServiceRegistry serviceRegistry) {
buildingOptions = new MetadataBuilderImpl.MetadataBuildingOptionsImpl( serviceRegistry );
bootstrapContext = new BootstrapContextImpl( serviceRegistry, buildingOptions );
mappingDefaults = new MetadataBuilderImpl.MappingDefaultsImpl( serviceRegistry );
metadataCollector = new InFlightMetadataCollectorImpl( bootstrapContext, buildingOptions );
objectNameNormalizer = new ObjectNameNormalizer() {
@Override
protected MetadataBuildingContext getBuildingContext() {
return MetadataBuildingContextTestingImpl.this;
}
};
}
@Override
public BootstrapContext getBootstrapContext() {
return bootstrapContext;
}
@Override
public MetadataBuildingOptions getBuildingOptions() {
return buildingOptions;
}
@Override
public MappingDefaults getMappingDefaults() {
return mappingDefaults;
}
@Override
public InFlightMetadataCollector getMetadataCollector() {
return metadataCollector;
}
@Override
public ClassLoaderAccess getClassLoaderAccess() {
return bootstrapContext.getClassLoaderAccess();
}
@Override
public ObjectNameNormalizer getObjectNameNormalizer() {
return objectNameNormalizer;
}
}