HHH-6507 Adds TypeContributingIntegrator.

This commit is contained in:
Karel Maesen 2012-03-24 00:03:16 +01:00 committed by Steve Ebersole
parent 1d5392d3d6
commit edcc34a291
2 changed files with 34 additions and 1 deletions

View File

@ -0,0 +1,21 @@
package org.hibernate.integrator.spi;
import org.hibernate.metamodel.spi.source.MetadataImplementor;
/**
* @author Karel Maesen, Geovise BVBA
* creation-date: 3/23/12
*/
public interface TypeContributingIntegrator extends Integrator {
/**
* Allows the <code>Integrator</code> to modify the <code>MetadataImplementor</code>
* prior to building the metadata, presumably to register additional types in the
* <code>TypeRegistry</code>.
*
*
* @param builder
*/
public void prepareTypes(MetadataImplementor builder);
}

View File

@ -26,6 +26,9 @@ package org.hibernate.metamodel.internal;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import org.jboss.logging.Logger;
import org.hibernate.AssertionFailure;
import org.hibernate.DuplicateMappingException;
import org.hibernate.MappingException;
@ -39,6 +42,9 @@ import org.hibernate.engine.spi.NamedQueryDefinition;
import org.hibernate.engine.spi.NamedSQLQueryDefinition;
import org.hibernate.id.factory.IdentifierGeneratorFactory;
import org.hibernate.id.factory.spi.MutableIdentifierGeneratorFactory;
import org.hibernate.integrator.spi.Integrator;
import org.hibernate.integrator.spi.IntegratorService;
import org.hibernate.integrator.spi.TypeContributingIntegrator;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.Value;
import org.hibernate.metamodel.MetadataSourceProcessingOrder;
@ -65,7 +71,6 @@ import org.hibernate.persister.spi.PersisterClassResolver;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.classloading.spi.ClassLoaderService;
import org.hibernate.type.TypeResolver;
import org.jboss.logging.Logger;
/**
* Container for configuration data collected during binding the metamodel.
@ -149,6 +154,13 @@ public class MetadataImpl implements MetadataImplementor, Serializable {
}
);
//check for typeContributingIntegrators integrators
for ( Integrator integrator : serviceRegistry.getService( IntegratorService.class ).getIntegrators() ) {
if ( TypeContributingIntegrator.class.isInstance( integrator ) ) {
TypeContributingIntegrator.class.cast( integrator ).prepareTypes( this );
}
}
processTypeDefinitions( metadataSourceProcessors );
processFilterDefinitions( metadataSourceProcessors );
processIdentifierGenerators( metadataSourceProcessors );