From 69091d1394871db0401416847c9fb90847254042 Mon Sep 17 00:00:00 2001 From: Gavin Date: Thu, 15 Dec 2022 15:27:34 +0100 Subject: [PATCH] remove two unused classes --- .../model/convert/spi/Converters.java | 48 ----------------- .../spi/SimpleBasicValueConverter.java | 53 ------------------- 2 files changed, 101 deletions(-) delete mode 100644 hibernate-core/src/main/java/org/hibernate/metamodel/model/convert/spi/Converters.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/metamodel/model/convert/spi/SimpleBasicValueConverter.java diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/convert/spi/Converters.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/convert/spi/Converters.java deleted file mode 100644 index c6a3c82b12..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/convert/spi/Converters.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 - */ -package org.hibernate.metamodel.model.convert.spi; - -import org.hibernate.SessionFactory; -import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.metamodel.model.convert.internal.JpaAttributeConverterImpl; -import org.hibernate.resource.beans.spi.ManagedBean; -import org.hibernate.resource.beans.spi.ManagedBeanRegistry; -import org.hibernate.type.descriptor.java.JavaType; -import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry; -import org.hibernate.type.spi.TypeConfiguration; - -import jakarta.persistence.AttributeConverter; - -/** - * Factory for converter instances - * - * @author Steve Ebersole - */ -public class Converters { - /** - * Generates a BasicValueConverter based on an {@link AttributeConverter} - */ - public static BasicValueConverter jpaAttributeConverter( - JavaType relationalJtd, - JavaType domainJtd, - Class> converterClass, - SessionFactory factory) { - final SessionFactoryImplementor sfi = (SessionFactoryImplementor) factory; - - final ManagedBeanRegistry beanRegistry = sfi.getServiceRegistry().getService( ManagedBeanRegistry.class ); - final ManagedBean> converterBean = beanRegistry.getBean( converterClass ); - - final TypeConfiguration typeConfiguration = sfi.getTypeConfiguration(); - final JavaTypeRegistry jtdRegistry = typeConfiguration.getJavaTypeRegistry(); - final JavaType> converterJtd = jtdRegistry.getDescriptor( converterClass ); - - return new JpaAttributeConverterImpl<>( converterBean, converterJtd, domainJtd, relationalJtd ); - } - - private Converters() { - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/convert/spi/SimpleBasicValueConverter.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/convert/spi/SimpleBasicValueConverter.java deleted file mode 100644 index 511d890340..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/convert/spi/SimpleBasicValueConverter.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 - */ -package org.hibernate.metamodel.model.convert.spi; - -import java.util.function.Function; - -import org.hibernate.type.descriptor.java.JavaType; - -/** - * @author Steve Ebersole - */ -public class SimpleBasicValueConverter implements BasicValueConverter { - private final JavaType domainJtd; - private final JavaType relationalJtd; - - private final Function toDomainHandler; - private final Function toRelationalHandler; - - public SimpleBasicValueConverter( - JavaType domainJtd, - JavaType relationalJtd, - Function toDomainHandler, - Function toRelationalHandler) { - this.domainJtd = domainJtd; - this.relationalJtd = relationalJtd; - this.toDomainHandler = toDomainHandler; - this.toRelationalHandler = toRelationalHandler; - } - - @Override - public D toDomainValue(R relationalForm) { - return toDomainHandler.apply( relationalForm ); - } - - @Override - public R toRelationalValue(D domainForm) { - return toRelationalHandler.apply( domainForm ); - } - - @Override - public JavaType getDomainJavaType() { - return domainJtd; - } - - @Override - public JavaType getRelationalJavaType() { - return relationalJtd; - } -}