Skip to content

Commit

Permalink
move FormatMapper and its implementations to a dedicated package
Browse files Browse the repository at this point in the history
it doesn't belong in the root org.hibernate.type namespace!
  • Loading branch information
gavinking committed Dec 29, 2022
1 parent aef9d06 commit 8aba946
Show file tree
Hide file tree
Showing 18 changed files with 68 additions and 37 deletions.
Expand Up @@ -50,7 +50,6 @@
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;
Expand All @@ -70,10 +69,10 @@
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;
Expand Down
Expand Up @@ -41,11 +41,11 @@
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;

Expand Down
Expand Up @@ -35,7 +35,7 @@
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}
Expand Down
Expand Up @@ -32,7 +32,7 @@
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}.
Expand Down Expand Up @@ -314,14 +314,22 @@ default boolean isCollectionsInDefaultFetchGroupEnabled() {
@Incubating
int getPreferredSqlTypeCodeForArray();

@Incubating
TimeZoneStorageStrategy getDefaultTimeZoneStorageStrategy();

/**
* The format mapper to use for serializing/deserializing JSON data.
*
* @since 6.0
*/
@Incubating
FormatMapper getJsonFormatMapper();

/**
* The format mapper to use for serializing/deserializing XML data.
*
* @since 6.0.1
*/
@Incubating
FormatMapper getXmlFormatMapper();
}
Expand Up @@ -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},
Expand All @@ -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},
Expand All @@ -2758,6 +2759,7 @@ public interface AvailableSettings {
*
* @since 6.0.1
*/
@Incubating
String XML_FORMAT_MAPPER = "hibernate.type.xml_format_mapper";

/**
Expand Down
Expand Up @@ -66,7 +66,7 @@
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;
Expand Down
Expand Up @@ -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;

Expand All @@ -25,8 +26,12 @@
* @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 {

/**
Expand Down
Expand Up @@ -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 {

Expand Down
Expand Up @@ -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;

Expand Down
Expand Up @@ -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;

Expand Down
Expand Up @@ -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;
Expand Up @@ -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 {

Expand Down
Expand Up @@ -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;

Expand Down
Expand Up @@ -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;
Expand Up @@ -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;
Expand All @@ -23,7 +23,7 @@
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;
Expand Down
Expand Up @@ -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;
@@ -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;
Expand Up @@ -38,6 +38,5 @@
*
* @see org.hibernate.type.Type
* @see org.hibernate.type.SqlTypes
* @see org.hibernate.type.FormatMapper
*/
package org.hibernate.type;

0 comments on commit 8aba946

Please sign in to comment.