move FormatMapper and its implementations to a dedicated package

it doesn't belong in the root org.hibernate.type namespace!
This commit is contained in:
Gavin 2022-12-29 22:04:21 +01:00 committed by Gavin King
parent aef9d064db
commit 8aba946e77
18 changed files with 68 additions and 37 deletions

View File

@ -50,7 +50,6 @@ import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.EmptyInterceptor;
import org.hibernate.internal.util.NullnessHelper;
import org.hibernate.internal.util.PropertiesHelper;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.jpa.spi.JpaCompliance;
import org.hibernate.jpa.spi.MutableJpaCompliance;
@ -70,10 +69,10 @@ import org.hibernate.resource.jdbc.spi.StatementInspector;
import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder;
import org.hibernate.service.spi.ServiceRegistryImplementor;
import org.hibernate.stat.Statistics;
import org.hibernate.type.FormatMapper;
import org.hibernate.type.jackson.JacksonIntegration;
import org.hibernate.type.jakartajson.JakartaJsonIntegration;
import org.hibernate.type.jaxb.JaxbXmlFormatMapper;
import org.hibernate.type.format.FormatMapper;
import org.hibernate.type.format.jackson.JacksonIntegration;
import org.hibernate.type.format.jakartajson.JakartaJsonIntegration;
import org.hibernate.type.format.jaxb.JaxbXmlFormatMapper;
import static org.hibernate.cfg.AvailableSettings.ALLOW_JTA_TRANSACTION_ACCESS;
import static org.hibernate.cfg.AvailableSettings.ALLOW_REFRESH_DETACHED_ENTITY;

View File

@ -41,11 +41,11 @@ import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy;
import org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorBuilderImpl;
import org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorBuilderImpl;
import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder;
import org.hibernate.type.FormatMapper;
import org.hibernate.type.jackson.JacksonJsonFormatMapper;
import org.hibernate.type.jackson.JacksonXmlFormatMapper;
import org.hibernate.type.jaxb.JaxbXmlFormatMapper;
import org.hibernate.type.jakartajson.JsonBJsonFormatMapper;
import org.hibernate.type.format.FormatMapper;
import org.hibernate.type.format.jackson.JacksonJsonFormatMapper;
import org.hibernate.type.format.jackson.JacksonXmlFormatMapper;
import org.hibernate.type.format.jaxb.JaxbXmlFormatMapper;
import org.hibernate.type.format.jakartajson.JsonBJsonFormatMapper;
import org.jboss.logging.Logger;

View File

@ -35,7 +35,7 @@ import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy;
import org.hibernate.query.sqm.sql.SqmTranslatorFactory;
import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode;
import org.hibernate.resource.jdbc.spi.StatementInspector;
import org.hibernate.type.FormatMapper;
import org.hibernate.type.format.FormatMapper;
/**
* Convenience base class for custom implementations of {@link SessionFactoryOptions}

View File

@ -32,7 +32,7 @@ import org.hibernate.query.sqm.NullPrecedence;
import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode;
import org.hibernate.resource.jdbc.spi.StatementInspector;
import org.hibernate.stat.Statistics;
import org.hibernate.type.FormatMapper;
import org.hibernate.type.format.FormatMapper;
/**
* Aggregator of special options used to build the {@link org.hibernate.SessionFactory}.
@ -314,8 +314,15 @@ public interface SessionFactoryOptions extends QueryEngineOptions {
@Incubating
int getPreferredSqlTypeCodeForArray();
@Incubating
TimeZoneStorageStrategy getDefaultTimeZoneStorageStrategy();
/**
* The format mapper to use for serializing/deserializing JSON data.
*
* @since 6.0
*/
@Incubating
FormatMapper getJsonFormatMapper();
/**
@ -323,5 +330,6 @@ public interface SessionFactoryOptions extends QueryEngineOptions {
*
* @since 6.0.1
*/
@Incubating
FormatMapper getXmlFormatMapper();
}

View File

@ -2727,8 +2727,8 @@ public interface AvailableSettings {
String PREFERRED_INSTANT_JDBC_TYPE = "hibernate.type.preferred_instant_jdbc_type";
/**
* Specifies a {@link org.hibernate.type.FormatMapper} used for JSON serialization
* and deserialization, either:
* Specifies a {@link org.hibernate.type.format.FormatMapper} used for JSON
* serialization and deserialization, either:
* <ul>
* <li>an instance of {@code FormatMapper},
* <li>a {@link Class} representing a class that implements {@code FormatMapper},
@ -2741,11 +2741,12 @@ public interface AvailableSettings {
*
* @since 6.0
*/
@Incubating
String JSON_FORMAT_MAPPER = "hibernate.type.json_format_mapper";
/**
* Specifies a {@link org.hibernate.type.FormatMapper} used for XML serialization
* and deserialization, either:
* Specifies a {@link org.hibernate.type.format.FormatMapper} used for XML
* serialization and deserialization, either:
* <ul>
* <li>an instance of {@code FormatMapper},
* <li>a {@link Class} representing a class that implements {@code FormatMapper},
@ -2758,6 +2759,7 @@ public interface AvailableSettings {
*
* @since 6.0.1
*/
@Incubating
String XML_FORMAT_MAPPER = "hibernate.type.xml_format_mapper";
/**

View File

@ -66,7 +66,7 @@ import org.hibernate.jpa.internal.util.ConfigurationHelper;
import org.hibernate.jpa.internal.util.LockOptionsHelper;
import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder;
import org.hibernate.service.spi.ServiceRegistryImplementor;
import org.hibernate.type.FormatMapper;
import org.hibernate.type.format.FormatMapper;
import jakarta.persistence.CacheRetrieveMode;
import jakarta.persistence.CacheStoreMode;

View File

@ -4,8 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.type;
package org.hibernate.type.format;
import org.hibernate.Incubating;
import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaType;
@ -25,8 +26,12 @@ import org.hibernate.type.descriptor.java.JavaType;
* @see org.hibernate.boot.spi.SessionFactoryOptions#getJsonFormatMapper()
* @see org.hibernate.boot.spi.SessionFactoryOptions#getXmlFormatMapper()
*
* @see org.hibernate.type.descriptor.jdbc.JsonJdbcType
* @see org.hibernate.type.descriptor.jdbc.XmlJdbcType
*
* @author Christian Beikov
*/
@Incubating
public interface FormatMapper {
/**

View File

@ -4,9 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.type.jackson;
package org.hibernate.type.format.jackson;
import org.hibernate.type.FormatMapper;
import org.hibernate.type.format.FormatMapper;
public final class JacksonIntegration {

View File

@ -4,9 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.type.jackson;
package org.hibernate.type.format.jackson;
import org.hibernate.type.FormatMapper;
import org.hibernate.type.format.FormatMapper;
import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaType;

View File

@ -4,9 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.type.jackson;
package org.hibernate.type.format.jackson;
import org.hibernate.type.FormatMapper;
import org.hibernate.type.format.FormatMapper;
import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaType;

View File

@ -6,6 +6,6 @@
*/
/**
* An implementations of {@link org.hibernate.type.FormatMapper} using Jakarta JSON.
* Implementations of {@link org.hibernate.type.format.FormatMapper} using Jackson.
*/
package org.hibernate.type.jakartajson;
package org.hibernate.type.format.jackson;

View File

@ -4,9 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.type.jakartajson;
package org.hibernate.type.format.jakartajson;
import org.hibernate.type.FormatMapper;
import org.hibernate.type.format.FormatMapper;
public final class JakartaJsonIntegration {

View File

@ -4,9 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.type.jakartajson;
package org.hibernate.type.format.jakartajson;
import org.hibernate.type.FormatMapper;
import org.hibernate.type.format.FormatMapper;
import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaType;

View File

@ -6,6 +6,6 @@
*/
/**
* An implementations of {@link org.hibernate.type.FormatMapper} using JAXB.
* An implementation of {@link org.hibernate.type.format.FormatMapper} using Jakarta JSON.
*/
package org.hibernate.type.jaxb;
package org.hibernate.type.format.jakartajson;

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.type.jaxb;
package org.hibernate.type.format.jaxb;
import java.io.StringReader;
import java.io.StringWriter;
@ -23,7 +23,7 @@ import javax.xml.namespace.QName;
import org.hibernate.internal.util.ReflectHelper;
import org.hibernate.internal.util.collections.CollectionHelper;
import org.hibernate.sql.ast.spi.StringBuilderSqlAppender;
import org.hibernate.type.FormatMapper;
import org.hibernate.type.format.FormatMapper;
import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.BasicPluralJavaType;
import org.hibernate.type.descriptor.java.JavaType;

View File

@ -6,6 +6,6 @@
*/
/**
* Implementations of {@link org.hibernate.type.FormatMapper} using Jackson.
* An implementation of {@link org.hibernate.type.format.FormatMapper} using JAXB.
*/
package org.hibernate.type.jackson;
package org.hibernate.type.format.jaxb;

View File

@ -0,0 +1,18 @@
/*
* 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 <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
/**
* Support for type mappings which format composite values to a structured
* text format (JSON or XML) for storage in a database-specific column type
* supporting that structured format.
*
* @see org.hibernate.type.format.FormatMapper
*/
@Incubating
package org.hibernate.type.format;
import org.hibernate.Incubating;

View File

@ -38,6 +38,5 @@
*
* @see org.hibernate.type.Type
* @see org.hibernate.type.SqlTypes
* @see org.hibernate.type.FormatMapper
*/
package org.hibernate.type;