HHH-7998 - Add TypeContributions contract

Conflicts:
	hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java
	hibernate-core/src/main/java/org/hibernate/metamodel/internal/MetadataImpl.java
	hibernate-core/src/main/java/org/hibernate/metamodel/spi/TypeContributor.java
This commit is contained in:
Steve Ebersole 2013-04-30 10:36:38 -04:00 committed by Brett Meyer
parent 2d0a757157
commit aecd5a444b
3 changed files with 88 additions and 0 deletions

View File

@ -77,7 +77,9 @@ import org.hibernate.internal.util.StringHelper;
import org.hibernate.internal.util.collections.ArrayHelper; import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.internal.util.io.StreamCopier; import org.hibernate.internal.util.io.StreamCopier;
import org.hibernate.mapping.Column; import org.hibernate.mapping.Column;
import org.hibernate.metamodel.spi.TypeContributions;
import org.hibernate.persister.entity.Lockable; import org.hibernate.persister.entity.Lockable;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.sql.ANSICaseFragment; import org.hibernate.sql.ANSICaseFragment;
import org.hibernate.sql.ANSIJoinFragment; import org.hibernate.sql.ANSIJoinFragment;
import org.hibernate.sql.CaseFragment; import org.hibernate.sql.CaseFragment;
@ -272,6 +274,10 @@ public abstract class Dialect implements ConversionContext {
// database type mapping support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // database type mapping support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
// by default, nothing to do
}
/** /**
* Get the name of the database type associated with the given * Get the name of the database type associated with the given
* {@link java.sql.Types} typecode. * {@link java.sql.Types} typecode.

View File

@ -0,0 +1,41 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2012, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.spi;
import org.hibernate.type.BasicType;
import org.hibernate.usertype.CompositeUserType;
import org.hibernate.usertype.UserType;
/**
* Defines the target contributing types, whether via dialects or {@link TypeContributor}
*
* @author Steve Ebersole
*/
public interface TypeContributions {
public void contributeType(BasicType type);
public void contributeType(UserType type, String[] keys);
public void contributeType(CompositeUserType type, String[] keys);
}

View File

@ -0,0 +1,41 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2012, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.spi;
import org.hibernate.service.ServiceRegistry;
/**
* Contract for contributing types.
*
* @author Steve Ebersole
*/
public interface TypeContributor {
/**
* Contribute types
*
* @param typeContributions The callback for adding contributed types
* @param serviceRegistry The service registry
*/
public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry);
}