Use java.lang.reflect.Type instead of java.lang.Class for JavaTypeDescriptor#getJavaType to support parameterized types

This commit is contained in:
Christian Beikov 2021-02-22 16:00:54 +01:00
parent 6b66feb0ac
commit 6643e9f4bc
133 changed files with 369 additions and 268 deletions

View File

@ -12,14 +12,14 @@ import java.util.List;
import java.util.stream.Collectors;
import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.AbstractTypeDescriptor;
import org.hibernate.type.descriptor.java.AbstractClassTypeDescriptor;
import org.hibernate.type.descriptor.java.MutableMutabilityPlan;
/**
* @author Vlad Mihalcea
*/
//tag::collections-comma-delimited-collection-example[]
public class CommaDelimitedStringsJavaTypeDescriptor extends AbstractTypeDescriptor<List> {
public class CommaDelimitedStringsJavaTypeDescriptor extends AbstractClassTypeDescriptor<List> {
public static final String DELIMITER = ",";

View File

@ -3,13 +3,13 @@ package org.hibernate.userguide.mapping.basic;
import java.util.BitSet;
import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.AbstractTypeDescriptor;
import org.hibernate.type.descriptor.java.AbstractClassTypeDescriptor;
/**
* @author Vlad Mihalcea
*/
//tag::basic-custom-type-BitSetTypeDescriptor-example[]
public class BitSetTypeDescriptor extends AbstractTypeDescriptor<BitSet> {
public class BitSetTypeDescriptor extends AbstractClassTypeDescriptor<BitSet> {
private static final String DELIMITER = ",";

View File

@ -1,14 +1,14 @@
package org.hibernate.userguide.mapping.basic;
import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.AbstractTypeDescriptor;
import org.hibernate.type.descriptor.java.AbstractClassTypeDescriptor;
import org.hibernate.type.descriptor.java.CharacterTypeDescriptor;
/**
* @author Vlad Mihalcea
*/
//tag::basic-enums-custom-type-example[]
public class GenderJavaTypeDescriptor extends AbstractTypeDescriptor<Gender> {
public class GenderJavaTypeDescriptor extends AbstractClassTypeDescriptor<Gender> {
public static final GenderJavaTypeDescriptor INSTANCE =
new GenderJavaTypeDescriptor();

View File

@ -55,7 +55,7 @@ public class TypeDefinitionRegistryStandardImpl implements TypeDefinitionRegistr
return null;
}
return typeDefinitionMap.get( jtd.getJavaType().getName() );
return typeDefinitionMap.get( jtd.getJavaType().getTypeName() );
}
@Override

View File

@ -184,7 +184,7 @@ public class InferredBasicValueResolver {
case STRING: {
final JavaTypeDescriptor<?> relationalJtd;
if ( explicitJavaType != null ) {
if ( ! String.class.isAssignableFrom( explicitJavaType.getJavaType() ) ) {
if ( ! String.class.isAssignableFrom( explicitJavaType.getJavaTypeClass() ) ) {
throw new MappingException(
"Explicit JavaTypeDescriptor [" + explicitJavaType +
"] applied to enumerated value with EnumType#STRING" +
@ -210,7 +210,7 @@ public class InferredBasicValueResolver {
//noinspection unchecked
final org.hibernate.type.EnumType legacyEnumType = new org.hibernate.type.EnumType(
enumJavaDescriptor.getJavaType(),
enumJavaDescriptor.getJavaTypeClass(),
valueConverter,
typeConfiguration
);
@ -233,7 +233,7 @@ public class InferredBasicValueResolver {
case ORDINAL: {
final JavaTypeDescriptor<Integer> relationalJtd;
if ( explicitJavaType != null ) {
if ( ! Integer.class.isAssignableFrom( explicitJavaType.getJavaType() ) ) {
if ( ! Integer.class.isAssignableFrom( explicitJavaType.getJavaTypeClass() ) ) {
throw new MappingException(
"Explicit JavaTypeDescriptor [" + explicitJavaType +
"] applied to enumerated value with EnumType#ORDINAL" +
@ -258,7 +258,7 @@ public class InferredBasicValueResolver {
//noinspection unchecked
final org.hibernate.type.EnumType legacyEnumType = new org.hibernate.type.EnumType(
enumJavaDescriptor.getJavaType(),
enumJavaDescriptor.getJavaTypeClass(),
valueConverter,
typeConfiguration
);

View File

@ -187,11 +187,11 @@ public class NamedConverterResolution<J> implements BasicValue.Resolution<J> {
// this.jdbcMapping = new StandardBasicTypeImpl( relationalJtd, relationalStd );
this.legacyResolvedType = new AttributeConverterTypeAdapter(
ConverterDescriptor.TYPE_NAME_PREFIX + valueConverter.getConverterJavaTypeDescriptor().getJavaType().getName(),
ConverterDescriptor.TYPE_NAME_PREFIX + valueConverter.getConverterJavaTypeDescriptor().getJavaType().getTypeName(),
String.format(
"BasicType adapter for AttributeConverter<%s,%s>",
domainJtd.getJavaType().getSimpleName(),
relationalJtd.getJavaType().getSimpleName()
domainJtd.getJavaType().getTypeName(),
relationalJtd.getJavaType().getTypeName()
),
valueConverter,
relationalStd,

View File

@ -3634,14 +3634,14 @@ public abstract class Dialect implements ConversionContext {
switch (jdbcTypeCode) {
case Types.BIT:
// Use the default length for Boolean if we encounter the JPA default 255 instead
if ( javaType.getJavaType() == Boolean.class && length != null && length == 255 ) {
if ( javaType.getJavaTypeClass() == Boolean.class && length != null && length == 255 ) {
length = null;
}
size.setLength( javaType.getDefaultSqlLength( Dialect.this ) );
break;
case Types.CHAR:
// Use the default length for char if we encounter the JPA default 255 instead
if ( javaType.getJavaType() == Character.class && length != null && length == 255 ) {
if ( javaType.getJavaTypeClass() == Character.class && length != null && length == 255 ) {
length = null;
}
size.setLength( javaType.getDefaultSqlLength( Dialect.this ) );
@ -3652,7 +3652,7 @@ public abstract class Dialect implements ConversionContext {
case Types.NVARCHAR:
case Types.VARBINARY:
// Use the default length for UUID if we encounter the JPA default 255 instead
if ( javaType.getJavaType() == UUID.class && length != null && length == 255 ) {
if ( javaType.getJavaTypeClass() == UUID.class && length != null && length == 255 ) {
length = null;
}
size.setLength( javaType.getDefaultSqlLength( Dialect.this ) );

View File

@ -38,7 +38,7 @@ public abstract class AbstractParameterDescriptor implements QueryParameter {
@Override
public Class getParameterType() {
return expectedType == null ? null : expectedType.getExpressableJavaTypeDescriptor().getJavaType();
return expectedType == null ? null : expectedType.getExpressableJavaTypeDescriptor().getJavaTypeClass();
}
@Override

View File

@ -136,7 +136,7 @@ public class DefaultLoadEventListener implements LoadEventListener {
final EntityMappingType dependentIdTargetMapping = (EntityMappingType) singleIdAttribute.getMappedType();
final EntityIdentifierMapping dependentIdTargetIdMapping = dependentIdTargetMapping.getIdentifierMapping();
final JavaTypeDescriptor dependentParentIdJtd = dependentIdTargetIdMapping.getMappedType().getMappedJavaTypeDescriptor();
if ( dependentParentIdJtd.getJavaType().isInstance( event.getEntityId() ) ) {
if ( dependentParentIdJtd.getJavaTypeClass().isInstance( event.getEntityId() ) ) {
// yep that's what we have...
loadByDerivedIdentitySimplePkValue(
event,

View File

@ -62,7 +62,7 @@ public class SingleIdEntityLoaderProvidedQueryImpl<T> implements SingleIdEntityL
//noinspection unchecked
final QueryImplementor<T> query = namedQueryMemento.toQuery(
session,
entityDescriptor.getMappedJavaTypeDescriptor().getJavaType()
entityDescriptor.getMappedJavaTypeDescriptor().getJavaTypeClass()
);
query.setParameter( 0, pkValue );

View File

@ -607,7 +607,7 @@ public abstract class SimpleValue implements KeyValue {
jdbcTypeCode = LobTypeMappings.getLobCodeTypeMapping( jdbcTypeCode );
}
else {
if ( Serializable.class.isAssignableFrom( domainJtd.getJavaType() ) ) {
if ( Serializable.class.isAssignableFrom( domainJtd.getJavaTypeClass() ) ) {
jdbcTypeCode = Types.BLOB;
}
else {
@ -648,11 +648,11 @@ public abstract class SimpleValue implements KeyValue {
// todo : cache the AttributeConverterTypeAdapter in case that AttributeConverter is applied multiple times.
final String name = ConverterDescriptor.TYPE_NAME_PREFIX + jpaAttributeConverter.getConverterJavaTypeDescriptor().getJavaType().getName();
final String name = ConverterDescriptor.TYPE_NAME_PREFIX + jpaAttributeConverter.getConverterJavaTypeDescriptor().getJavaType().getTypeName();
final String description = String.format(
"BasicType adapter for AttributeConverter<%s,%s>",
jpaAttributeConverter.getDomainJavaTypeDescriptor().getJavaType().getSimpleName(),
jpaAttributeConverter.getRelationalJavaTypeDescriptor().getJavaType().getSimpleName()
jpaAttributeConverter.getDomainJavaTypeDescriptor().getJavaType().getTypeName(),
jpaAttributeConverter.getRelationalJavaTypeDescriptor().getJavaType().getTypeName()
);
return new AttributeConverterTypeAdapter<>(
name,

View File

@ -589,7 +589,7 @@ public class AttributeFactory {
final EmbeddableDomainType<?> ownerType = (EmbeddableDomainType) attributeContext.getOwnerType();
if ( ownerType.getRepresentationStrategy().getMode() == RepresentationMode.MAP ) {
return new MapMember( attributeContext.getPropertyMapping().getName(), ownerType.getExpressableJavaTypeDescriptor().getJavaType() );
return new MapMember( attributeContext.getPropertyMapping().getName(), ownerType.getExpressableJavaTypeDescriptor().getJavaTypeClass() );
}
else {
return ownerType.getRepresentationStrategy()

View File

@ -17,7 +17,7 @@ public class OptimizedPojoInstantiatorImpl<J> extends AbstractPojoInstantiator {
private final ReflectionOptimizer.InstantiationOptimizer instantiationOptimizer;
public OptimizedPojoInstantiatorImpl(JavaTypeDescriptor javaTypeDescriptor, ReflectionOptimizer.InstantiationOptimizer instantiationOptimizer) {
super( javaTypeDescriptor.getJavaType() );
super( javaTypeDescriptor.getJavaTypeClass() );
this.instantiationOptimizer = instantiationOptimizer;
}

View File

@ -26,7 +26,7 @@ public class PojoInstantiatorImpl<J> extends AbstractPojoInstantiator {
@SuppressWarnings("WeakerAccess")
public PojoInstantiatorImpl(JavaTypeDescriptor javaTypeDescriptor) {
super( javaTypeDescriptor.getJavaType() );
super( javaTypeDescriptor.getJavaTypeClass() );
this.constructor = isAbstract()
? null

View File

@ -126,14 +126,14 @@ public class StandardPojoEmbeddableRepresentationStrategy extends AbstractEmbedd
String.format(
Locale.ROOT,
"Could not resolve PropertyAccess for attribute `%s#%s`",
getEmbeddableJavaTypeDescriptor().getJavaType().getName(),
getEmbeddableJavaTypeDescriptor().getJavaType().getTypeName(),
bootAttributeDescriptor.getName()
)
);
}
return strategy.buildPropertyAccess(
getEmbeddableJavaTypeDescriptor().getJavaType(),
getEmbeddableJavaTypeDescriptor().getJavaTypeClass(),
bootAttributeDescriptor.getName()
);
}

View File

@ -160,7 +160,7 @@ public class StandardPojoEntityRepresentationStrategy implements EntityRepresent
if ( identifierProperty == null ) {
return PropertyAccessStrategyEmbeddedImpl.INSTANCE.buildPropertyAccess(
proxyJtd != null ? proxyJtd.getJavaType() : mappedJtd.getJavaType(),
proxyJtd != null ? proxyJtd.getJavaTypeClass() : mappedJtd.getJavaTypeClass(),
"id"
);
}
@ -175,10 +175,10 @@ public class StandardPojoEntityRepresentationStrategy implements EntityRepresent
final Set<Class> proxyInterfaces = new java.util.HashSet<>();
final Class mappedClass = mappedJtd.getJavaType();
final Class mappedClass = mappedJtd.getJavaTypeClass();
Class proxyInterface;
if ( proxyJtd != null ) {
proxyInterface = proxyJtd.getJavaType();
proxyInterface = proxyJtd.getJavaTypeClass();
}
else {
proxyInterface = null;
@ -261,10 +261,10 @@ public class StandardPojoEntityRepresentationStrategy implements EntityRepresent
final Class javaTypeToReflect;
if ( proxyFactory != null ) {
assert proxyJtd != null;
javaTypeToReflect = proxyJtd.getJavaType();
javaTypeToReflect = proxyJtd.getJavaTypeClass();
}
else {
javaTypeToReflect = mappedJtd.getJavaType();
javaTypeToReflect = mappedJtd.getJavaTypeClass();
}
final List<String> getterNames = new ArrayList<>();
@ -348,13 +348,13 @@ public class StandardPojoEntityRepresentationStrategy implements EntityRepresent
String.format(
Locale.ROOT,
"Could not resolve PropertyAccess for attribute `%s#%s`",
mappedJtd.getJavaType().getName(),
mappedJtd.getJavaType().getTypeName(),
bootAttributeDescriptor.getName()
)
);
}
return strategy.buildPropertyAccess( mappedJtd.getJavaType(), bootAttributeDescriptor.getName() );
return strategy.buildPropertyAccess( mappedJtd.getJavaTypeClass(), bootAttributeDescriptor.getName() );
}
@Override

View File

@ -86,7 +86,7 @@ public class EmbeddedAttributeMapping
if ( parentInjectionAttributeName != null ) {
parentInjectionAttributePropertyAccess = PropertyAccessStrategyBasicImpl.INSTANCE.buildPropertyAccess(
embeddableMappingType.getMappedJavaTypeDescriptor().getJavaType(),
embeddableMappingType.getMappedJavaTypeDescriptor().getJavaTypeClass(),
parentInjectionAttributeName
);
}

View File

@ -78,7 +78,7 @@ public class EmbeddedCollectionPart implements CollectionPart, EmbeddableValuedF
this.nature = nature;
if ( parentInjectionAttributeName != null ) {
parentInjectionAttributePropertyAccess = PropertyAccessStrategyBasicImpl.INSTANCE.buildPropertyAccess(
embeddableMappingType.getMappedJavaTypeDescriptor().getJavaType(),
embeddableMappingType.getMappedJavaTypeDescriptor().getJavaTypeClass(),
parentInjectionAttributeName
);
}

View File

@ -102,10 +102,10 @@ public class SimpleNaturalIdMapping extends AbstractNaturalIdMapping {
}
}
if ( ! getJavaTypeDescriptor().getJavaType().isInstance( naturalIdValue ) ) {
if ( ! getJavaTypeDescriptor().getJavaTypeClass().isInstance( naturalIdValue ) ) {
throw new IllegalArgumentException(
"Incoming natural-id value [" + naturalIdValue + "] is not of expected type ["
+ getJavaTypeDescriptor().getJavaType().getName() + "]"
+ getJavaTypeDescriptor().getJavaType().getTypeName() + "]"
);
}
}

View File

@ -32,6 +32,6 @@ public abstract class AbstractDomainType<J> implements SimpleDomainType<J> {
@Override
public Class<J> getJavaType() {
return getExpressableJavaTypeDescriptor().getJavaType();
return getExpressableJavaTypeDescriptor().getJavaTypeClass();
}
}

View File

@ -35,7 +35,7 @@ public interface DomainType<J> extends SqmExpressable<J> {
*/
default String getTypeName() {
// default impl to handle the general case returning the Java type name
return getExpressableJavaTypeDescriptor().getJavaType().getName();
return getExpressableJavaTypeDescriptor().getJavaType().getTypeName();
}
/**

View File

@ -64,7 +64,7 @@ public abstract class AbstractAttribute<D,J,B> implements PersistentAttribute<D,
@Override
public Class<J> getJavaType() {
return attributeJtd.getJavaType();
return attributeJtd.getJavaTypeClass();
}
public SimpleDomainType<B> getSqmPathType() {

View File

@ -49,6 +49,6 @@ public abstract class AbstractSqmPathSource<J> implements SqmPathSource<J> {
@Override
public Class<J> getBindableJavaType() {
return getExpressableJavaTypeDescriptor().getJavaType();
return getExpressableJavaTypeDescriptor().getJavaTypeClass();
}
}

View File

@ -26,7 +26,7 @@ public class AnyMappingDomainTypeImpl<T> implements AnyMappingDomainType<T> {
@Override
public Class<T> getJavaType() {
return baseJtd.getJavaType();
return baseJtd.getJavaTypeClass();
}
@Override

View File

@ -59,7 +59,7 @@ public class BasicSqmPathSource<J>
@Override
public Class<J> getJavaType() {
return getExpressableJavaTypeDescriptor().getJavaType();
return getExpressableJavaTypeDescriptor().getJavaTypeClass();
}
@Override

View File

@ -36,7 +36,7 @@ public class BasicTypeImpl<J> implements BasicDomainType<J>, Serializable {
}
public Class<J> getJavaType() {
return getExpressableJavaTypeDescriptor().getJavaType();
return getExpressableJavaTypeDescriptor().getJavaTypeClass();
}
@Override

View File

@ -56,7 +56,7 @@ public class EmbeddableTypeImpl<J>
EmbeddableRepresentationStrategy representationStrategy,
boolean isDynamic,
JpaMetamodel domainMetamodel) {
super( javaTypeDescriptor.getJavaType().getName(), javaTypeDescriptor, null, domainMetamodel );
super( javaTypeDescriptor.getJavaType().getTypeName(), javaTypeDescriptor, null, domainMetamodel );
this.representationStrategy = representationStrategy;
this.isDynamic = isDynamic;
}

View File

@ -102,7 +102,7 @@ public class EntityTypeImpl<J>
@Override
public Class<?> getBindableJavaType() {
return getExpressableJavaTypeDescriptor().getJavaType();
return getExpressableJavaTypeDescriptor().getJavaTypeClass();
}
@Override

View File

@ -26,7 +26,7 @@ public class MappedSuperclassTypeImpl<X> extends AbstractIdentifiableType<X> imp
IdentifiableDomainType<? super X> superType,
JpaMetamodel jpaMetamodel) {
super(
javaTypeDescriptor.getJavaType().getName(),
javaTypeDescriptor.getJavaType().getTypeName(),
javaTypeDescriptor,
superType,
mappedSuperclass.getDeclaredIdentifierMapper() != null || ( superType != null && superType.hasIdClass() ),

View File

@ -84,42 +84,42 @@ public class PluralAttributeBuilder<D, C, E, K> {
attributeMetadata.getMember()
);
if ( Map.class.equals( attributeJtd.getJavaType() ) ) {
if ( Map.class.equals( attributeJtd.getJavaTypeClass() ) ) {
//noinspection unchecked
return new MapAttributeImpl<>( builder, metadataContext );
}
else if ( Set.class.equals( attributeJtd.getJavaType() ) ) {
else if ( Set.class.equals( attributeJtd.getJavaTypeClass() ) ) {
//noinspection unchecked
return new SetAttributeImpl<>( builder, metadataContext );
}
else if ( List.class.equals( attributeJtd.getJavaType() ) ) {
else if ( List.class.equals( attributeJtd.getJavaTypeClass() ) ) {
//noinspection unchecked
return new ListAttributeImpl<>( builder, metadataContext );
}
else if ( Collection.class.equals( attributeJtd.getJavaType() ) ) {
else if ( Collection.class.equals( attributeJtd.getJavaTypeClass() ) ) {
//noinspection unchecked
return new BagAttributeImpl<>( builder, metadataContext );
}
//apply loose rules
if ( attributeJtd.getJavaType().isArray() ) {
if ( attributeJtd.getJavaTypeClass().isArray() ) {
//noinspection unchecked
return new ListAttributeImpl<>( builder, metadataContext );
}
if ( Map.class.isAssignableFrom( attributeJtd.getJavaType() ) ) {
if ( Map.class.isAssignableFrom( attributeJtd.getJavaTypeClass() ) ) {
//noinspection unchecked
return new MapAttributeImpl<>( builder, metadataContext );
}
else if ( Set.class.isAssignableFrom( attributeJtd.getJavaType() ) ) {
else if ( Set.class.isAssignableFrom( attributeJtd.getJavaTypeClass() ) ) {
//noinspection unchecked
return new SetAttributeImpl<>( builder, metadataContext );
}
else if ( List.class.isAssignableFrom( attributeJtd.getJavaType() ) ) {
else if ( List.class.isAssignableFrom( attributeJtd.getJavaTypeClass() ) ) {
//noinspection unchecked
return new ListAttributeImpl<>( builder, metadataContext );
}
else if ( Collection.class.isAssignableFrom( attributeJtd.getJavaType() ) ) {
else if ( Collection.class.isAssignableFrom( attributeJtd.getJavaTypeClass() ) ) {
//noinspection unchecked
return new BagAttributeImpl<>( builder, metadataContext );
}

View File

@ -107,7 +107,7 @@ public class SingularAttributeImpl<D,J>
@Override
public Class<J> getBindableJavaType() {
return getExpressableJavaTypeDescriptor().getJavaType();
return getExpressableJavaTypeDescriptor().getJavaTypeClass();
}
@Override

View File

@ -5320,7 +5320,7 @@ public abstract class AbstractEntityPersister
}
public final Class getMappedClass() {
return getMappedJavaTypeDescriptor().getJavaType();
return getMappedJavaTypeDescriptor().getJavaTypeClass();
}
public boolean implementsLifecycle() {
@ -5329,7 +5329,7 @@ public abstract class AbstractEntityPersister
public Class getConcreteProxyClass() {
final JavaTypeDescriptor<?> proxyJavaTypeDescriptor = getRepresentationStrategy().getProxyJavaTypeDescriptor();
return proxyJavaTypeDescriptor != null ? proxyJavaTypeDescriptor.getJavaType() : javaTypeDescriptor.getJavaType();
return proxyJavaTypeDescriptor != null ? proxyJavaTypeDescriptor.getJavaTypeClass() : javaTypeDescriptor.getJavaTypeClass();
}
public void setPropertyValues(Object object, Object[] values) {

View File

@ -21,6 +21,6 @@ public interface JpaTupleElement<T> extends TupleElement<T>, JpaCriteriaNode {
@Override
default Class<? extends T> getJavaType() {
// todo (6.0) : can this signature just return `Class<T>`?
return getJavaTypeDescriptor() == null ? null : getJavaTypeDescriptor().getJavaType();
return getJavaTypeDescriptor() == null ? null : getJavaTypeDescriptor().getJavaTypeClass();
}
}

View File

@ -36,6 +36,6 @@ public abstract class AbstractQueryParameterImpl<T> implements QueryParameter<T>
@Override
public Class<T> getParameterType() {
return expectedType == null ? null : expectedType.getExpressableJavaTypeDescriptor().getJavaType();
return expectedType == null ? null : expectedType.getExpressableJavaTypeDescriptor().getJavaTypeClass();
}
}

View File

@ -74,7 +74,7 @@ public class BindingTypeHelper {
javaType = bindValue.getClass();
}
else if ( baseType != null ) {
javaType = baseType.getExpressableJavaTypeDescriptor().getJavaType();
javaType = baseType.getExpressableJavaTypeDescriptor().getJavaTypeClass();
}
else {
javaType = java.sql.Timestamp.class;
@ -98,7 +98,7 @@ public class BindingTypeHelper {
public AllowableParameterType resolveTimestampTemporalTypeVariant(Class javaType, AllowableParameterType baseType) {
//noinspection unchecked
if ( baseType.getExpressableJavaTypeDescriptor().getJavaType().isAssignableFrom( javaType ) ) {
if ( baseType.getExpressableJavaTypeDescriptor().getJavaTypeClass().isAssignableFrom( javaType ) ) {
return baseType;
}
@ -130,7 +130,7 @@ public class BindingTypeHelper {
}
public AllowableParameterType<?> resolveDateTemporalTypeVariant(Class<?> javaType, AllowableParameterType<?> baseType) {
if ( baseType.getExpressableJavaTypeDescriptor().getJavaType().isAssignableFrom( javaType ) ) {
if ( baseType.getExpressableJavaTypeDescriptor().getJavaTypeClass().isAssignableFrom( javaType ) ) {
return baseType;
}

View File

@ -170,7 +170,7 @@ public class QueryParameterBindingImpl<T> implements QueryParameterBinding<T> {
//noinspection unchecked
this.bindType = (AllowableParameterType) BindingTypeHelper.INSTANCE.resolveDateTemporalTypeVariant(
getBindType().getExpressableJavaTypeDescriptor().getJavaType(),
getBindType().getExpressableJavaTypeDescriptor().getJavaTypeClass(),
getBindType()
);

View File

@ -32,7 +32,7 @@ public class QueryParameterBindingValidator {
// nothing we can check
return;
}
final Class parameterType = paramType.getExpressableJavaTypeDescriptor().getJavaType();
final Class parameterType = paramType.getExpressableJavaTypeDescriptor().getJavaTypeClass();
if ( parameterType == null ) {
// nothing we can check
return;

View File

@ -141,7 +141,7 @@ public class ConcreteSqmSelectQueryPlan<R> implements SelectQueryPlan<R> {
final SqmSelection selection = selections.get( i );
tupleElementList.add(
new TupleElementImpl<>(
selection.getSelectableNode().getJavaTypeDescriptor().getJavaType(),
selection.getSelectableNode().getJavaTypeDescriptor().getJavaTypeClass(),
selection.getAlias()
)
);

View File

@ -323,11 +323,11 @@ public class QuerySqmImpl<R>
assert sqmExpressable != null;
assert sqmExpressable.getExpressableJavaTypeDescriptor() != null;
if ( ! resultClass.isAssignableFrom( sqmExpressable.getExpressableJavaTypeDescriptor().getJavaType() ) ) {
if ( ! resultClass.isAssignableFrom( sqmExpressable.getExpressableJavaTypeDescriptor().getJavaTypeClass() ) ) {
final String errorMessage = String.format(
"Specified result type [%s] did not match Query selection type [%s] - multiple selections: use Tuple or array",
resultClass.getName(),
sqmExpressable.getExpressableJavaTypeDescriptor().getJavaType().getName()
sqmExpressable.getExpressableJavaTypeDescriptor().getJavaType().getTypeName()
);
if ( sessionFactory.getSessionFactoryOptions().getJpaCompliance().isJpaQueryComplianceEnabled() ) {

View File

@ -846,7 +846,7 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
@Override
public Class<T> getJavaType() {
return javaTypeDescriptor.getJavaType();
return javaTypeDescriptor.getJavaTypeClass();
}
}

View File

@ -282,7 +282,7 @@ public class SqmUtil {
if ( type instanceof EntityIdentifierMapping ) {
mappingExpressable = type;
EntityIdentifierMapping identifierMapping = (EntityIdentifierMapping) type;
if ( !identifierMapping.getJavaTypeDescriptor().getJavaType().isInstance( bindValue ) ) {
if ( !identifierMapping.getJavaTypeDescriptor().getJavaTypeClass().isInstance( bindValue ) ) {
bindValue = identifierMapping.getIdentifier( bindValue, session );
}
}

View File

@ -193,8 +193,8 @@ public final class StandardArgumentsValidators {
public static ArgumentsValidator of(Class<?> javaType) {
return arguments -> arguments.forEach(
arg -> {
Class<?> argType = arg.getNodeJavaTypeDescriptor().getJavaType();
if (!javaType.isAssignableFrom(argType)) {
Class<?> argType = arg.getNodeJavaTypeDescriptor().getJavaTypeClass();
if ( !javaType.isAssignableFrom( argType ) ) {
throw new QueryException(
String.format(
Locale.ROOT,

View File

@ -102,7 +102,7 @@ public class SqmPolymorphicRootDescriptor<T> implements EntityDomainType<T> {
@Override
public String getName() {
return polymorphicJavaDescriptor.getJavaType().getName();
return polymorphicJavaDescriptor.getJavaType().getTypeName();
}
@Override
@ -132,7 +132,7 @@ public class SqmPolymorphicRootDescriptor<T> implements EntityDomainType<T> {
@Override
public Class<T> getBindableJavaType() {
return polymorphicJavaDescriptor.getJavaType();
return polymorphicJavaDescriptor.getJavaTypeClass();
}
@Override

View File

@ -52,6 +52,6 @@ public abstract class AbstractSqmParameter<T> extends AbstractSqmExpression<T> i
@Override
public Class<T> getParameterType() {
return this.getNodeType().getExpressableJavaTypeDescriptor().getJavaType();
return this.getNodeType().getExpressableJavaTypeDescriptor().getJavaTypeClass();
}
}

View File

@ -156,7 +156,8 @@ public class Compatibility {
// todo (6.0) - base this in the descriptor.
// `JavaTypeDescriptor#assignableFrom` ?
// Note from Christian: I think this is a good idea to allow honoring parameterized types
return areAssignmentCompatible( to.getJavaType(), from.getJavaType() );
return areAssignmentCompatible( to.getJavaTypeClass(), from.getJavaTypeClass() );
}
}

View File

@ -118,7 +118,7 @@ public class JpaCriteriaParameter<T>
@Override
public Class<T> getParameterType() {
return this.getNodeType().getExpressableJavaTypeDescriptor().getJavaType();
return this.getNodeType().getExpressableJavaTypeDescriptor().getJavaTypeClass();
}
@Override

View File

@ -67,7 +67,7 @@ public class SqmEnumLiteral<E extends Enum<E>> extends AbstractSqmExpression<E>
String.format(
Locale.ROOT,
"Static enum reference [%s#%s] cannot be de-referenced",
referencedEnumTypeDescriptor.getJavaType().getName(),
referencedEnumTypeDescriptor.getJavaType().getTypeName(),
enumValueName
)
);
@ -82,7 +82,7 @@ public class SqmEnumLiteral<E extends Enum<E>> extends AbstractSqmExpression<E>
String.format(
Locale.ROOT,
"Static enum reference [%s#%s] cannot be de-referenced",
referencedEnumTypeDescriptor.getJavaType().getName(),
referencedEnumTypeDescriptor.getJavaType().getTypeName(),
enumValueName
)
);

View File

@ -209,7 +209,7 @@ public class SqmFieldLiteral<T> implements SqmExpression<T>, SqmExpressable<T>,
String.format(
Locale.ROOT,
"Static field reference [%s#%s] cannot be de-referenced",
fieldJavaTypeDescriptor.getJavaType().getName(),
fieldJavaTypeDescriptor.getJavaType().getTypeName(),
fieldName
)
);
@ -224,7 +224,7 @@ public class SqmFieldLiteral<T> implements SqmExpression<T>, SqmExpressable<T>,
String.format(
Locale.ROOT,
"Static field reference [%s#%s] cannot be de-referenced",
fieldJavaTypeDescriptor.getJavaType().getName(),
fieldJavaTypeDescriptor.getJavaType().getTypeName(),
fieldName
)
);

View File

@ -36,6 +36,6 @@ public interface SqmDynamicInstantiationTarget<T> extends SqmExpressable<T> {
* @return The type to be instantiated.
*/
default Class getJavaType() {
return getTargetTypeDescriptor().getJavaType();
return getTargetTypeDescriptor().getJavaTypeClass();
}
}

View File

@ -81,7 +81,7 @@ public class SqmJpaCompoundSelection<T>
@Override
public Class<T> getJavaType() {
return getJavaTypeDescriptor().getJavaType();
return getJavaTypeDescriptor().getJavaTypeClass();
}
@Override

View File

@ -63,12 +63,12 @@ public class BasicResultAssembler<J> implements DomainResultAssembler<J> {
if ( valueConverter != null ) {
if ( jdbcValue != null ) {
// the raw value type should be the converter's relational-JTD
if ( ! valueConverter.getRelationalJavaDescriptor().getJavaType().isInstance( jdbcValue ) ) {
if ( ! valueConverter.getRelationalJavaDescriptor().getJavaTypeClass().isInstance( jdbcValue ) ) {
throw new HibernateException(
String.format(
Locale.ROOT,
"Expecting raw JDBC value of type `%s`, but found `%s` : [%s]",
valueConverter.getRelationalJavaDescriptor().getJavaType().getName(),
valueConverter.getRelationalJavaDescriptor().getJavaType().getTypeName(),
jdbcValue.getClass().getName(),
jdbcValue
)

View File

@ -55,7 +55,7 @@ public class DynamicInstantiation<T> implements DomainResultProducer {
* todo (6.0) : remove this. find usages and replace with #getTargetJavaTypeDescriptor
*/
public Class<T> getTargetJavaType() {
return getTargetJavaTypeDescriptor().getJavaType();
return getTargetJavaTypeDescriptor().getJavaTypeClass();
}
public void addArgument(String alias, DomainResultProducer argumentResultProducer) {
@ -63,7 +63,7 @@ public class DynamicInstantiation<T> implements DomainResultProducer {
throw new ConversionException( "Unexpected call to DynamicInstantiation#addAgument after previously complete" );
}
if ( List.class.equals( getTargetJavaTypeDescriptor().getJavaType() ) ) {
if ( List.class.equals( getTargetJavaTypeDescriptor().getJavaTypeClass() ) ) {
// really should not have an alias...
if ( alias != null && log.isDebugEnabled() ) {
log.debugf(
@ -74,7 +74,7 @@ public class DynamicInstantiation<T> implements DomainResultProducer {
);
}
}
else if ( Map.class.equals( getTargetJavaTypeDescriptor().getJavaType() ) ) {
else if ( Map.class.equals( getTargetJavaTypeDescriptor().getJavaTypeClass() ) ) {
// must have an alias...
if ( alias == null ) {
log.warnf(
@ -104,7 +104,7 @@ public class DynamicInstantiation<T> implements DomainResultProducer {
@Override
public String toString() {
return "DynamicInstantiation(" + getTargetJavaTypeDescriptor().getJavaType().getName() + ")";
return "DynamicInstantiation(" + getTargetJavaTypeDescriptor().getJavaType().getTypeName() + ")";
}
@Override

View File

@ -31,7 +31,7 @@ public class DynamicInstantiationAssemblerInjectionImpl<T> implements DomainResu
JavaTypeDescriptor<T> target,
List<ArgumentReader<?>> argumentReaders) {
this.target = target;
final Class targetJavaType = target.getJavaType();
final Class targetJavaType = target.getJavaTypeClass();
BeanInfoHelper.visitBeanInfo(
targetJavaType,
@ -67,7 +67,7 @@ public class DynamicInstantiationAssemblerInjectionImpl<T> implements DomainResu
final Field field = findField(
targetJavaType,
argumentReader.getAlias(),
argumentReader.getAssembledJavaTypeDescriptor().getJavaType()
argumentReader.getAssembledJavaTypeDescriptor().getJavaTypeClass()
);
if ( field != null ) {
beanInjections.add(
@ -116,7 +116,7 @@ public class DynamicInstantiationAssemblerInjectionImpl<T> implements DomainResu
@SuppressWarnings("unchecked")
public T assemble(RowProcessingState rowProcessingState, JdbcValuesSourceProcessingOptions options) {
try {
final T result = target.getJavaType().newInstance();
final T result = target.getJavaTypeClass().newInstance();
for ( BeanInjection beanInjection : beanInjections ) {
beanInjection.getBeanInjector().inject(
result,
@ -126,7 +126,7 @@ public class DynamicInstantiationAssemblerInjectionImpl<T> implements DomainResu
return result;
}
catch (IllegalAccessException | InstantiationException | java.lang.InstantiationException e) {
throw new InstantiationException( "Could not call default constructor [" + target.getJavaType().getSimpleName() + "]", e );
throw new InstantiationException( "Could not call default constructor [" + target.getJavaType().getTypeName() + "]", e );
}
}
}

View File

@ -142,7 +142,7 @@ public class DynamicInstantiationResultImpl<R> implements DynamicInstantiationRe
else {
// find a constructor matching argument types
constructor_loop:
for ( Constructor<?> constructor : javaTypeDescriptor.getJavaType().getDeclaredConstructors() ) {
for ( Constructor<?> constructor : javaTypeDescriptor.getJavaTypeClass().getDeclaredConstructors() ) {
if ( constructor.getParameterTypes().length != argumentReaders.size() ) {
continue;
}
@ -165,7 +165,7 @@ public class DynamicInstantiationResultImpl<R> implements DynamicInstantiationRe
"Skipping constructor for dynamic-instantiation match due to argument mismatch [%s] : %s -> %s",
i,
constructor.getParameterTypes()[i].getName(),
argumentTypeDescriptor.getJavaType().getName()
argumentTypeDescriptor.getJavaType().getTypeName()
);
}
continue constructor_loop;
@ -184,7 +184,7 @@ public class DynamicInstantiationResultImpl<R> implements DynamicInstantiationRe
if ( log.isDebugEnabled() ) {
log.debugf(
"Could not locate appropriate constructor for dynamic instantiation of [%s]; attempting bean-injection instantiation",
javaTypeDescriptor.getJavaType().getName()
javaTypeDescriptor.getJavaType().getTypeName()
);
}

View File

@ -86,7 +86,7 @@ public class StandardEntityGraphTraversalStateImpl implements EntityGraphTravers
else {
assert !exploreKeySubgraph;
subgraphMap = attributeNode.getSubGraphMap();
subgraphMapKey = fetchable.getJavaTypeDescriptor().getJavaType();
subgraphMapKey = fetchable.getJavaTypeDescriptor().getJavaTypeClass();
}
if ( subgraphMap != null && subgraphMapKey != null ) {
currentGraphContext = subgraphMap.get( subgraphMapKey );
@ -108,7 +108,7 @@ public class StandardEntityGraphTraversalStateImpl implements EntityGraphTravers
private Class<?> getEntityCollectionPartJavaClass(CollectionPart collectionPart) {
if ( collectionPart instanceof EntityCollectionPart ) {
EntityCollectionPart entityCollectionPart = (EntityCollectionPart) collectionPart;
return entityCollectionPart.getEntityMappingType().getJavaTypeDescriptor().getJavaType();
return entityCollectionPart.getEntityMappingType().getJavaTypeDescriptor().getJavaTypeClass();
}
else {
return null;

View File

@ -68,7 +68,7 @@ public class StandardRowReader<T> implements RowReader<T> {
@SuppressWarnings("unchecked")
public Class<T> getResultJavaType() {
if ( resultAssemblers.size() == 1 ) {
return (Class<T>) resultAssemblers.get( 0 ).getAssembledJavaTypeDescriptor().getJavaType();
return (Class<T>) resultAssemblers.get( 0 ).getAssembledJavaTypeDescriptor().getJavaTypeClass();
}
return (Class<T>) Object[].class;

View File

@ -83,7 +83,7 @@ public abstract class AbstractStandardBasicType<T>
@Override
public Class<T> getJavaType() {
return getExpressableJavaTypeDescriptor().getJavaType();
return getExpressableJavaTypeDescriptor().getJavaTypeClass();
}
public T fromString(String string) {
@ -121,7 +121,7 @@ public abstract class AbstractStandardBasicType<T>
@Override
public String[] getRegistrationKeys() {
return registerUnderJavaType()
? new String[] { getName(), javaTypeDescriptor.getJavaType().getName() }
? new String[] { getName(), javaTypeDescriptor.getJavaType().getTypeName() }
: new String[] { getName() };
}
@ -164,7 +164,7 @@ public abstract class AbstractStandardBasicType<T>
@Override
public final Class getReturnedClass() {
return javaTypeDescriptor.getJavaType();
return javaTypeDescriptor.getJavaTypeClass();
}
@Override

View File

@ -49,6 +49,10 @@ public class BasicTypeRegistry implements Serializable {
return (BasicType<J>) typesByName.get( key );
}
public <J> BasicType<J> getRegisteredType(java.lang.reflect.Type javaType) {
return getRegisteredType( javaType.getTypeName() );
}
public <J> BasicType<J> getRegisteredType(Class<J> javaType) {
return getRegisteredType( javaType.getName() );
}

View File

@ -371,7 +371,7 @@ public class CustomType
@Override
public Class getJavaType() {
return mappedJavaTypeDescriptor.getJavaType();
return mappedJavaTypeDescriptor.getJavaTypeClass();
}
@Override

View File

@ -28,7 +28,7 @@ public class StandardBasicTypeTemplate<J> extends AbstractSingleColumnStandardBa
super( sqlTypeDescriptor, javaTypeDescriptor );
this.registrationKeys = registrationKeys;
this.name = javaTypeDescriptor.getJavaType() == null ? "(map-mode)" : javaTypeDescriptor.getJavaType().getName()
this.name = javaTypeDescriptor.getJavaType() == null ? "(map-mode)" : javaTypeDescriptor.getJavaType().getTypeName()
+ " -> " + sqlTypeDescriptor.getSqlType();
}

View File

@ -0,0 +1,103 @@
/*
* 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.type.descriptor.java;
import java.io.Serializable;
import java.util.Comparator;
import java.util.Objects;
import org.hibernate.HibernateException;
import org.hibernate.internal.util.compare.ComparableComparator;
/**
* Abstract adapter for Java type descriptors.
*
* @apiNote This abstract descriptor implements BasicJavaDescriptor
* because we currently only categorize "basic" JavaTypeDescriptors,
* as in the {@link javax.persistence.metamodel.Type.PersistenceType#BASIC}
* sense
*
* @author Steve Ebersole
*/
public abstract class AbstractClassTypeDescriptor<T> implements BasicJavaDescriptor<T>, Serializable {
private final Class<T> type;
private final MutabilityPlan<T> mutabilityPlan;
private final Comparator<T> comparator;
/**
* Initialize a type descriptor for the given type. Assumed immutable.
*
* @param type The Java type.
*
* @see #AbstractClassTypeDescriptor(Class, MutabilityPlan)
*/
@SuppressWarnings({ "unchecked" })
protected AbstractClassTypeDescriptor(Class<T> type) {
this( type, (MutabilityPlan<T>) ImmutableMutabilityPlan.INSTANCE );
}
/**
* Initialize a type descriptor for the given type. Assumed immutable.
*
* @param type The Java type.
* @param mutabilityPlan The plan for handling mutability aspects of the java type.
*/
@SuppressWarnings({ "unchecked" })
protected AbstractClassTypeDescriptor(Class<T> type, MutabilityPlan<T> mutabilityPlan) {
this.type = type;
this.mutabilityPlan = mutabilityPlan;
this.comparator = Comparable.class.isAssignableFrom( type )
? (Comparator<T>) ComparableComparator.INSTANCE
: null;
}
@Override
public MutabilityPlan<T> getMutabilityPlan() {
return mutabilityPlan;
}
public Class<T> getJavaType() {
return type;
}
@Override
public Class<T> getJavaTypeClass() {
return getJavaType();
}
@Override
public int extractHashCode(T value) {
return value.hashCode();
}
@Override
public boolean areEqual(T one, T another) {
return Objects.equals( one, another );
}
@Override
public Comparator<T> getComparator() {
return comparator;
}
@Override
public String extractLoggableRepresentation(T value) {
return (value == null) ? "null" : value.toString();
}
protected HibernateException unknownUnwrap(Class conversionType) {
throw new HibernateException(
"Unknown unwrap conversion requested: " + type.getName() + " to " + conversionType.getName()
);
}
protected HibernateException unknownWrap(Class conversionType) {
throw new HibernateException(
"Unknown wrap conversion requested: " + conversionType.getName() + " to " + type.getName()
);
}
}

View File

@ -13,7 +13,7 @@ import org.hibernate.type.spi.TypeConfiguration;
/**
* @author Steve Ebersole
*/
public abstract class AbstractTemporalTypeDescriptor<T> extends AbstractTypeDescriptor<T> implements TemporalJavaTypeDescriptor<T> {
public abstract class AbstractTemporalTypeDescriptor<T> extends AbstractClassTypeDescriptor<T> implements TemporalJavaTypeDescriptor<T> {
protected AbstractTemporalTypeDescriptor(Class<T> type) {
super( type );
}
@ -70,6 +70,6 @@ public abstract class AbstractTemporalTypeDescriptor<T> extends AbstractTypeDesc
@Override
public String toString() {
return "TemporalJavaTypeDescriptor(javaType=" + getJavaType().getName() + ")";
return "TemporalJavaTypeDescriptor(javaType=" + getJavaType().getTypeName() + ")";
}
}

View File

@ -7,6 +7,7 @@
package org.hibernate.type.descriptor.java;
import java.io.Serializable;
import java.lang.reflect.Type;
import java.util.Comparator;
import java.util.Objects;
@ -24,7 +25,7 @@ import org.hibernate.internal.util.compare.ComparableComparator;
* @author Steve Ebersole
*/
public abstract class AbstractTypeDescriptor<T> implements BasicJavaDescriptor<T>, Serializable {
private final Class<T> type;
private final Type type;
private final MutabilityPlan<T> mutabilityPlan;
private final Comparator<T> comparator;
@ -33,10 +34,10 @@ public abstract class AbstractTypeDescriptor<T> implements BasicJavaDescriptor<T
*
* @param type The Java type.
*
* @see #AbstractTypeDescriptor(Class, MutabilityPlan)
* @see #AbstractTypeDescriptor(Type, MutabilityPlan)
*/
@SuppressWarnings({ "unchecked" })
protected AbstractTypeDescriptor(Class<T> type) {
protected AbstractTypeDescriptor(Type type) {
this( type, (MutabilityPlan<T>) ImmutableMutabilityPlan.INSTANCE );
}
@ -47,10 +48,10 @@ public abstract class AbstractTypeDescriptor<T> implements BasicJavaDescriptor<T
* @param mutabilityPlan The plan for handling mutability aspects of the java type.
*/
@SuppressWarnings({ "unchecked" })
protected AbstractTypeDescriptor(Class<T> type, MutabilityPlan<T> mutabilityPlan) {
protected AbstractTypeDescriptor(Type type, MutabilityPlan<T> mutabilityPlan) {
this.type = type;
this.mutabilityPlan = mutabilityPlan;
this.comparator = Comparable.class.isAssignableFrom( type )
this.comparator = Comparable.class.isAssignableFrom( getJavaTypeClass() )
? (Comparator<T>) ComparableComparator.INSTANCE
: null;
}
@ -60,17 +61,9 @@ public abstract class AbstractTypeDescriptor<T> implements BasicJavaDescriptor<T
return mutabilityPlan;
}
public Class<T> getJavaType() {
return type;
}
/**
* @deprecated Use {@link #getJavaType()} instead
*/
@Override
@Deprecated
public Class<T> getJavaTypeClass() {
return getJavaType();
public Type getJavaType() {
return type;
}
@Override
@ -95,13 +88,13 @@ public abstract class AbstractTypeDescriptor<T> implements BasicJavaDescriptor<T
protected HibernateException unknownUnwrap(Class conversionType) {
throw new HibernateException(
"Unknown unwrap conversion requested: " + type.getName() + " to " + conversionType.getName()
"Unknown unwrap conversion requested: " + type.getTypeName() + " to " + conversionType.getName()
);
}
protected HibernateException unknownWrap(Class conversionType) {
throw new HibernateException(
"Unknown wrap conversion requested: " + conversionType.getName() + " to " + type.getName()
"Unknown wrap conversion requested: " + conversionType.getName() + " to " + type.getTypeName()
);
}
}

View File

@ -30,7 +30,7 @@ public interface BasicJavaDescriptor<T> extends JavaTypeDescriptor<T> {
default SqlTypeDescriptor getJdbcRecommendedSqlType(SqlTypeDescriptorIndicators indicators) {
// match legacy behavior
return indicators.getTypeConfiguration().getSqlTypeDescriptorRegistry().getDescriptor(
JdbcTypeJavaClassMappings.INSTANCE.determineJdbcTypeCodeForJavaClass( getJavaType() )
JdbcTypeJavaClassMappings.INSTANCE.determineJdbcTypeCodeForJavaClass( getJavaTypeClass() )
);
}

View File

@ -17,7 +17,7 @@ import org.hibernate.type.descriptor.WrapperOptions;
*
* @author Steve Ebersole
*/
public class BigDecimalTypeDescriptor extends AbstractTypeDescriptor<BigDecimal> {
public class BigDecimalTypeDescriptor extends AbstractClassTypeDescriptor<BigDecimal> {
public static final BigDecimalTypeDescriptor INSTANCE = new BigDecimalTypeDescriptor();
public BigDecimalTypeDescriptor() {

View File

@ -17,7 +17,7 @@ import org.hibernate.type.descriptor.WrapperOptions;
*
* @author Steve Ebersole
*/
public class BigIntegerTypeDescriptor extends AbstractTypeDescriptor<BigInteger> {
public class BigIntegerTypeDescriptor extends AbstractClassTypeDescriptor<BigInteger> {
public static final BigIntegerTypeDescriptor INSTANCE = new BigIntegerTypeDescriptor();
public BigIntegerTypeDescriptor() {

View File

@ -31,7 +31,7 @@ import org.hibernate.type.descriptor.WrapperOptions;
* @author Steve Ebersole
* @author Brett Meyer
*/
public class BlobTypeDescriptor extends AbstractTypeDescriptor<Blob> {
public class BlobTypeDescriptor extends AbstractClassTypeDescriptor<Blob> {
public static final BlobTypeDescriptor INSTANCE = new BlobTypeDescriptor();
public static class BlobMutabilityPlan implements MutabilityPlan<Blob> {

View File

@ -17,7 +17,7 @@ import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
*
* @author Steve Ebersole
*/
public class BooleanTypeDescriptor extends AbstractTypeDescriptor<Boolean> implements Primitive<Boolean> {
public class BooleanTypeDescriptor extends AbstractClassTypeDescriptor<Boolean> implements Primitive<Boolean> {
public static final BooleanTypeDescriptor INSTANCE = new BooleanTypeDescriptor();
private final char characterValueTrue;

View File

@ -23,7 +23,7 @@ import org.hibernate.type.descriptor.WrapperOptions;
*
* @author Steve Ebersole
*/
public class ByteArrayTypeDescriptor extends AbstractTypeDescriptor<Byte[]> {
public class ByteArrayTypeDescriptor extends AbstractClassTypeDescriptor<Byte[]> {
public static final ByteArrayTypeDescriptor INSTANCE = new ByteArrayTypeDescriptor();
@SuppressWarnings({ "unchecked" })

View File

@ -15,7 +15,7 @@ import org.hibernate.type.descriptor.java.spi.Primitive;
* @author Steve Ebersole
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
*/
public class ByteTypeDescriptor extends AbstractTypeDescriptor<Byte> implements Primitive<Byte> {
public class ByteTypeDescriptor extends AbstractClassTypeDescriptor<Byte> implements Primitive<Byte> {
public static final ByteTypeDescriptor INSTANCE = new ByteTypeDescriptor();
public ByteTypeDescriptor() {

View File

@ -21,7 +21,7 @@ import org.hibernate.type.descriptor.WrapperOptions;
*
* @author Steve Ebersole
*/
public class CharacterArrayTypeDescriptor extends AbstractTypeDescriptor<Character[]> {
public class CharacterArrayTypeDescriptor extends AbstractClassTypeDescriptor<Character[]> {
public static final CharacterArrayTypeDescriptor INSTANCE = new CharacterArrayTypeDescriptor();
@SuppressWarnings({ "unchecked" })

View File

@ -5,22 +5,18 @@
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.type.descriptor.java;
import java.sql.Types;
import org.hibernate.HibernateException;
import org.hibernate.dialect.Dialect;
import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.spi.Primitive;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators;
import org.hibernate.type.spi.TypeConfiguration;
/**
* Descriptor for {@link Character} handling.
*
* @author Steve Ebersole
*/
public class CharacterTypeDescriptor extends AbstractTypeDescriptor<Character> implements Primitive<Character> {
public class CharacterTypeDescriptor extends AbstractClassTypeDescriptor<Character> implements Primitive<Character> {
public static final CharacterTypeDescriptor INSTANCE = new CharacterTypeDescriptor();
public CharacterTypeDescriptor() {

View File

@ -14,7 +14,7 @@ import org.hibernate.type.descriptor.WrapperOptions;
*
* @author Steve Ebersole
*/
public class ClassTypeDescriptor extends AbstractTypeDescriptor<Class> {
public class ClassTypeDescriptor extends AbstractClassTypeDescriptor<Class> {
public static final ClassTypeDescriptor INSTANCE = new ClassTypeDescriptor();
public ClassTypeDescriptor() {

View File

@ -33,7 +33,7 @@ import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry;
*
* @author Steve Ebersole
*/
public class ClobTypeDescriptor extends AbstractTypeDescriptor<Clob> {
public class ClobTypeDescriptor extends AbstractClassTypeDescriptor<Clob> {
public static final ClobTypeDescriptor INSTANCE = new ClobTypeDescriptor();
public ClobTypeDescriptor() {

View File

@ -15,7 +15,7 @@ import org.hibernate.type.descriptor.WrapperOptions;
*
* @author Steve Ebersole
*/
public class CurrencyTypeDescriptor extends AbstractTypeDescriptor<Currency> {
public class CurrencyTypeDescriptor extends AbstractClassTypeDescriptor<Currency> {
public static final CurrencyTypeDescriptor INSTANCE = new CurrencyTypeDescriptor();
public CurrencyTypeDescriptor() {

View File

@ -21,7 +21,7 @@ import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators;
*
* @author Steve Ebersole
*/
public class DoubleTypeDescriptor extends AbstractTypeDescriptor<Double> implements Primitive<Double> {
public class DoubleTypeDescriptor extends AbstractClassTypeDescriptor<Double> implements Primitive<Double> {
public static final DoubleTypeDescriptor INSTANCE = new DoubleTypeDescriptor();
public DoubleTypeDescriptor() {

View File

@ -32,7 +32,7 @@ import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators;
* @author Steve Ebersole
* @author Gavin King
*/
public class DurationJavaDescriptor extends AbstractTypeDescriptor<Duration> {
public class DurationJavaDescriptor extends AbstractClassTypeDescriptor<Duration> {
/**
* Singleton access
*/

View File

@ -22,7 +22,7 @@ import org.hibernate.type.descriptor.sql.VarcharTypeDescriptor;
*
* @author Steve Ebersole
*/
public class EnumJavaTypeDescriptor<T extends Enum<T>> extends AbstractTypeDescriptor<T> {
public class EnumJavaTypeDescriptor<T extends Enum<T>> extends AbstractClassTypeDescriptor<T> {
@SuppressWarnings("unchecked")
public EnumJavaTypeDescriptor(Class<T> type) {
super( type, ImmutableMutabilityPlan.INSTANCE );
@ -53,7 +53,7 @@ public class EnumJavaTypeDescriptor<T extends Enum<T>> extends AbstractTypeDescr
@Override
public T fromString(String string) {
return string == null ? null : Enum.valueOf( getJavaType(), string );
return string == null ? null : Enum.valueOf( getJavaTypeClass(), string );
}
@Override
@ -156,7 +156,7 @@ public class EnumJavaTypeDescriptor<T extends Enum<T>> extends AbstractTypeDescr
if ( relationalForm == null ) {
return null;
}
return getJavaType().getEnumConstants()[ relationalForm ];
return getJavaTypeClass().getEnumConstants()[ relationalForm ];
}
/**
@ -166,7 +166,7 @@ public class EnumJavaTypeDescriptor<T extends Enum<T>> extends AbstractTypeDescr
if ( relationalForm == null ) {
return null;
}
return getJavaType().getEnumConstants()[ relationalForm ];
return getJavaTypeClass().getEnumConstants()[ relationalForm ];
}
/**
@ -176,7 +176,7 @@ public class EnumJavaTypeDescriptor<T extends Enum<T>> extends AbstractTypeDescr
if ( relationalForm == null ) {
return null;
}
return getJavaType().getEnumConstants()[ relationalForm ];
return getJavaTypeClass().getEnumConstants()[ relationalForm ];
}
/**
@ -186,7 +186,7 @@ public class EnumJavaTypeDescriptor<T extends Enum<T>> extends AbstractTypeDescr
if ( relationalForm == null ) {
return null;
}
return getJavaType().getEnumConstants()[ relationalForm.intValue() ];
return getJavaTypeClass().getEnumConstants()[ relationalForm.intValue() ];
}
/**
@ -213,19 +213,19 @@ public class EnumJavaTypeDescriptor<T extends Enum<T>> extends AbstractTypeDescr
if ( relationalForm == null ) {
return null;
}
return Enum.valueOf( getJavaType(), relationalForm.trim() );
return Enum.valueOf( getJavaTypeClass(), relationalForm.trim() );
}
@Override
public String getCheckCondition(String columnName, SqlTypeDescriptor sqlTypeDescriptor, Dialect dialect) {
if (sqlTypeDescriptor instanceof TinyIntTypeDescriptor
|| sqlTypeDescriptor instanceof IntegerTypeDescriptor) {
int last = getJavaType().getEnumConstants().length - 1;
int last = getJavaTypeClass().getEnumConstants().length - 1;
return columnName + " between 0 and " + last;
}
else if (sqlTypeDescriptor instanceof VarcharTypeDescriptor) {
StringBuilder types = new StringBuilder();
for ( Enum<T> value : getJavaType().getEnumConstants() ) {
for ( Enum<T> value : getJavaTypeClass().getEnumConstants() ) {
if (types.length() != 0) {
types.append(", ");
}

View File

@ -18,7 +18,7 @@ import org.hibernate.type.descriptor.java.spi.Primitive;
*
* @author Steve Ebersole
*/
public class FloatTypeDescriptor extends AbstractTypeDescriptor<Float> implements Primitive<Float> {
public class FloatTypeDescriptor extends AbstractClassTypeDescriptor<Float> implements Primitive<Float> {
public static final FloatTypeDescriptor INSTANCE = new FloatTypeDescriptor();
public FloatTypeDescriptor() {

View File

@ -18,7 +18,7 @@ import org.hibernate.type.descriptor.java.spi.Primitive;
*
* @author Steve Ebersole
*/
public class IntegerTypeDescriptor extends AbstractTypeDescriptor<Integer> implements Primitive<Integer> {
public class IntegerTypeDescriptor extends AbstractClassTypeDescriptor<Integer> implements Primitive<Integer> {
public static final IntegerTypeDescriptor INSTANCE = new IntegerTypeDescriptor();
public IntegerTypeDescriptor() {

View File

@ -11,7 +11,7 @@ import org.hibernate.type.descriptor.WrapperOptions;
/**
* @author Steve Ebersole
*/
public class JavaObjectTypeDescriptor extends AbstractTypeDescriptor<Object> {
public class JavaObjectTypeDescriptor extends AbstractClassTypeDescriptor<Object> {
/**
* Singleton access
*/

View File

@ -7,6 +7,8 @@
package org.hibernate.type.descriptor.java;
import java.io.Serializable;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Comparator;
import java.util.Objects;
@ -26,7 +28,7 @@ public interface JavaTypeDescriptor<T> extends Serializable {
/**
* Get the Java type described
*/
default Class<T> getJavaType() {
default Type getJavaType() {
// default on this side since #getJavaTypeClass is the currently implemented method
return getJavaTypeClass();
}
@ -98,7 +100,7 @@ public interface JavaTypeDescriptor<T> extends Serializable {
*/
default Comparator<T> getComparator() {
//noinspection unchecked
return Comparable.class.isAssignableFrom( getJavaType() )
return Comparable.class.isAssignableFrom( getJavaTypeClass() )
? ComparableComparator.INSTANCE
: null;
}
@ -181,11 +183,20 @@ public interface JavaTypeDescriptor<T> extends Serializable {
* Retrieve the Java type handled here.
*
* @return The Java type.
*
* @deprecated Use {@link #getJavaType()} instead
*/
@Deprecated
Class<T> getJavaTypeClass();
default Class<T> getJavaTypeClass() {
final Type type = getJavaType();
if ( type == null ) {
return null;
}
else if ( type instanceof Class<?> ) {
return (Class<T>) type;
}
else if ( type instanceof ParameterizedType ) {
return (Class<T>) ( (ParameterizedType) type ).getRawType();
}
throw new UnsupportedOperationException( "Can't get java type class from type: " + type );
}
/**
* The check constraint that should be added to the column

View File

@ -88,7 +88,7 @@ public class JavaTypeDescriptorRegistry implements Serializable {
}
private JavaTypeDescriptor addDescriptorInternal(JavaTypeDescriptor descriptor) {
return descriptorsByClass.put( descriptor.getJavaType(), descriptor );
return descriptorsByClass.put( descriptor.getJavaTypeClass(), descriptor );
}
/**
@ -147,7 +147,7 @@ public class JavaTypeDescriptorRegistry implements Serializable {
}
public static class FallbackJavaTypeDescriptor<T> extends AbstractTypeDescriptor<T> {
public static class FallbackJavaTypeDescriptor<T> extends AbstractClassTypeDescriptor<T> {
protected FallbackJavaTypeDescriptor(final Class<T> type) {
super( type, createMutabilityPlan( type ) );
}
@ -177,7 +177,7 @@ public class JavaTypeDescriptorRegistry implements Serializable {
@Override
public T fromString(String string) {
throw new HibernateException(
"Not known how to convert String to given type [" + getJavaType().getName() + "]"
"Not known how to convert String to given type [" + getJavaType().getTypeName() + "]"
);
}

View File

@ -16,7 +16,7 @@ import org.hibernate.type.descriptor.WrapperOptions;
*
* @author Steve Ebersole
*/
public class LocaleTypeDescriptor extends AbstractTypeDescriptor<Locale> {
public class LocaleTypeDescriptor extends AbstractClassTypeDescriptor<Locale> {
public static final LocaleTypeDescriptor INSTANCE = new LocaleTypeDescriptor();
public static class LocaleComparator implements Comparator<Locale> {

View File

@ -18,7 +18,7 @@ import org.hibernate.type.descriptor.java.spi.Primitive;
*
* @author Steve Ebersole
*/
public class LongTypeDescriptor extends AbstractTypeDescriptor<Long>implements Primitive<Long> {
public class LongTypeDescriptor extends AbstractClassTypeDescriptor<Long> implements Primitive<Long> {
public static final LongTypeDescriptor INSTANCE = new LongTypeDescriptor();
public LongTypeDescriptor() {

View File

@ -28,7 +28,7 @@ import org.hibernate.type.descriptor.WrapperOptions;
*
* @author Steve Ebersole
*/
public class NClobTypeDescriptor extends AbstractTypeDescriptor<NClob> {
public class NClobTypeDescriptor extends AbstractClassTypeDescriptor<NClob> {
public static final NClobTypeDescriptor INSTANCE = new NClobTypeDescriptor();
public static class NClobMutabilityPlan implements MutabilityPlan<NClob> {

View File

@ -23,7 +23,7 @@ import org.hibernate.type.descriptor.WrapperOptions;
*
* @author Steve Ebersole
*/
public class PrimitiveByteArrayTypeDescriptor extends AbstractTypeDescriptor<byte[]> {
public class PrimitiveByteArrayTypeDescriptor extends AbstractClassTypeDescriptor<byte[]> {
public static final PrimitiveByteArrayTypeDescriptor INSTANCE = new PrimitiveByteArrayTypeDescriptor();
@SuppressWarnings({ "unchecked" })

View File

@ -21,7 +21,7 @@ import org.hibernate.type.descriptor.WrapperOptions;
*
* @author Steve Ebersole
*/
public class PrimitiveCharacterArrayTypeDescriptor extends AbstractTypeDescriptor<char[]> {
public class PrimitiveCharacterArrayTypeDescriptor extends AbstractClassTypeDescriptor<char[]> {
public static final PrimitiveCharacterArrayTypeDescriptor INSTANCE = new PrimitiveCharacterArrayTypeDescriptor();
@SuppressWarnings({ "unchecked" })

View File

@ -25,7 +25,7 @@ import org.hibernate.type.descriptor.WrapperOptions;
* @author Steve Ebersole
* @author Gail Badner
*/
public class RowVersionTypeDescriptor extends AbstractTypeDescriptor<byte[]> {
public class RowVersionTypeDescriptor extends AbstractClassTypeDescriptor<byte[]> {
public static final RowVersionTypeDescriptor INSTANCE = new RowVersionTypeDescriptor();
@SuppressWarnings({ "unchecked" })

View File

@ -26,7 +26,7 @@ import org.hibernate.type.descriptor.WrapperOptions;
* @author Steve Ebersole
* @author Brett meyer
*/
public class SerializableTypeDescriptor<T extends Serializable> extends AbstractTypeDescriptor<T> {
public class SerializableTypeDescriptor<T extends Serializable> extends AbstractClassTypeDescriptor<T> {
// unfortunately the param types cannot be the same so use something other than 'T' here to make that obvious
public static class SerializableMutabilityPlan<S extends Serializable> extends MutableMutabilityPlan<S> {
@ -123,7 +123,7 @@ public class SerializableTypeDescriptor<T extends Serializable> extends Abstract
throw new HibernateException( e );
}
}
else if ( getJavaType().isInstance( value ) ) {
else if ( getJavaTypeClass().isInstance( value ) ) {
return (T) value;
}
throw unknownWrap( value.getClass() );
@ -135,6 +135,6 @@ public class SerializableTypeDescriptor<T extends Serializable> extends Abstract
@SuppressWarnings({ "unchecked" })
protected T fromBytes(byte[] bytes) {
return (T) SerializationHelper.deserialize( bytes, getJavaType().getClassLoader() );
return (T) SerializationHelper.deserialize( bytes, getJavaTypeClass().getClassLoader() );
}
}

View File

@ -14,7 +14,7 @@ import org.hibernate.type.descriptor.java.spi.Primitive;
*
* @author Steve Ebersole
*/
public class ShortTypeDescriptor extends AbstractTypeDescriptor<Short> implements Primitive<Short> {
public class ShortTypeDescriptor extends AbstractClassTypeDescriptor<Short> implements Primitive<Short> {
public static final ShortTypeDescriptor INSTANCE = new ShortTypeDescriptor();
public ShortTypeDescriptor() {

View File

@ -14,8 +14,6 @@ import java.sql.Types;
import org.hibernate.engine.jdbc.CharacterStream;
import org.hibernate.engine.jdbc.internal.CharacterStreamImpl;
import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.sql.ClobTypeDescriptor;
import org.hibernate.type.descriptor.sql.NClobTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators;
import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry;
@ -26,7 +24,7 @@ import org.hibernate.type.spi.TypeConfiguration;
*
* @author Steve Ebersole
*/
public class StringTypeDescriptor extends AbstractTypeDescriptor<String> {
public class StringTypeDescriptor extends AbstractClassTypeDescriptor<String> {
public static final StringTypeDescriptor INSTANCE = new StringTypeDescriptor();
public StringTypeDescriptor() {

View File

@ -16,7 +16,7 @@ import org.hibernate.type.descriptor.WrapperOptions;
*
* @author Steve Ebersole
*/
public class TimeZoneTypeDescriptor extends AbstractTypeDescriptor<TimeZone> {
public class TimeZoneTypeDescriptor extends AbstractClassTypeDescriptor<TimeZone> {
public static final TimeZoneTypeDescriptor INSTANCE = new TimeZoneTypeDescriptor();
public static class TimeZoneComparator implements Comparator<TimeZone> {

View File

@ -20,7 +20,7 @@ import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators;
*
* @author Steve Ebersole
*/
public class UUIDTypeDescriptor extends AbstractTypeDescriptor<UUID> {
public class UUIDTypeDescriptor extends AbstractClassTypeDescriptor<UUID> {
public static final UUIDTypeDescriptor INSTANCE = new UUIDTypeDescriptor();
public UUIDTypeDescriptor() {

View File

@ -20,7 +20,7 @@ import org.hibernate.type.descriptor.sql.VarcharTypeDescriptor;
*
* @author Steve Ebersole
*/
public class UrlTypeDescriptor extends AbstractTypeDescriptor<URL> {
public class UrlTypeDescriptor extends AbstractClassTypeDescriptor<URL> {
public static final UrlTypeDescriptor INSTANCE = new UrlTypeDescriptor();
public UrlTypeDescriptor() {

View File

@ -19,7 +19,7 @@ import java.util.Comparator;
*
* @author Gavin King
*/
public class ZoneOffsetJavaDescriptor extends AbstractTypeDescriptor<ZoneOffset> {
public class ZoneOffsetJavaDescriptor extends AbstractClassTypeDescriptor<ZoneOffset> {
public static final ZoneOffsetJavaDescriptor INSTANCE = new ZoneOffsetJavaDescriptor();
public static class ZoneOffsetComparator implements Comparator<ZoneOffset> {

View File

@ -9,7 +9,7 @@ package org.hibernate.type.descriptor.java.spi;
import org.hibernate.collection.spi.CollectionSemantics;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.AbstractTypeDescriptor;
import org.hibernate.type.descriptor.java.AbstractClassTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators;
@ -23,7 +23,7 @@ import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators;
*
* @author Steve Ebersole
*/
public class CollectionJavaTypeDescriptor<C> extends AbstractTypeDescriptor<C> {
public class CollectionJavaTypeDescriptor<C> extends AbstractClassTypeDescriptor<C> {
private final CollectionSemantics<C,?> semantics;
@SuppressWarnings("unchecked")

View File

@ -7,7 +7,7 @@
package org.hibernate.type.descriptor.java.spi;
import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.AbstractTypeDescriptor;
import org.hibernate.type.descriptor.java.AbstractClassTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators;
@ -17,7 +17,7 @@ import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators;
*
* @author Steve Ebersole
*/
public class JavaTypeDescriptorBasicAdaptor<T> extends AbstractTypeDescriptor<T> {
public class JavaTypeDescriptorBasicAdaptor<T> extends AbstractClassTypeDescriptor<T> {
public JavaTypeDescriptorBasicAdaptor(Class<T> type) {
super( type );
}
@ -25,7 +25,7 @@ public class JavaTypeDescriptorBasicAdaptor<T> extends AbstractTypeDescriptor<T>
@Override
public SqlTypeDescriptor getJdbcRecommendedSqlType(SqlTypeDescriptorIndicators context) {
throw new UnsupportedOperationException(
"Recommended SqlTypeDescriptor not known for this Java type : " + getJavaType().getName()
"Recommended SqlTypeDescriptor not known for this Java type : " + getJavaType().getTypeName()
);
}
@ -37,26 +37,26 @@ public class JavaTypeDescriptorBasicAdaptor<T> extends AbstractTypeDescriptor<T>
@Override
public T fromString(String string) {
throw new UnsupportedOperationException(
"Conversion from String strategy not known for this Java type : " + getJavaType().getName()
"Conversion from String strategy not known for this Java type : " + getJavaType().getTypeName()
);
}
@Override
public <X> X unwrap(T value, Class<X> type, WrapperOptions options) {
throw new UnsupportedOperationException(
"Unwrap strategy not known for this Java type : " + getJavaType().getName()
"Unwrap strategy not known for this Java type : " + getJavaType().getTypeName()
);
}
@Override
public <X> T wrap(X value, WrapperOptions options) {
throw new UnsupportedOperationException(
"Wrap strategy not known for this Java type : " + getJavaType().getName()
"Wrap strategy not known for this Java type : " + getJavaType().getTypeName()
);
}
@Override
public String toString() {
return "JavaTypeDescriptorBasicAdaptor(" + getJavaType().getName() + ")";
return "JavaTypeDescriptorBasicAdaptor(" + getJavaType().getTypeName() + ")";
}
}

View File

@ -47,7 +47,7 @@ public class JavaTypeDescriptorRegistry implements JavaTypeDescriptorBaseline.Ba
if ( descriptor.getJavaType() == null ) {
throw new IllegalStateException( "Illegal to add BasicJavaTypeDescriptor with null Java type" );
}
addBaselineDescriptor( descriptor.getJavaType(), descriptor );
addBaselineDescriptor( descriptor.getJavaTypeClass(), descriptor );
}
@Override
@ -99,7 +99,7 @@ public class JavaTypeDescriptorRegistry implements JavaTypeDescriptorBaseline.Ba
}
public void addDescriptor(JavaTypeDescriptor descriptor) {
JavaTypeDescriptor old = descriptorsByClass.put( descriptor.getJavaType(), descriptor );
JavaTypeDescriptor old = descriptorsByClass.put( descriptor.getJavaTypeClass(), descriptor );
if ( old != null ) {
log.debugf(
"JavaTypeDescriptorRegistry entry replaced : %s -> %s (was %s)",

View File

@ -9,14 +9,14 @@ package org.hibernate.type.descriptor.java.spi;
import java.util.Map;
import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.AbstractTypeDescriptor;
import org.hibernate.type.descriptor.java.AbstractClassTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptorIndicators;
/**
* @author Steve Ebersole
*/
public class MapEntryJavaDescriptor extends AbstractTypeDescriptor<Map.Entry> {
public class MapEntryJavaDescriptor extends AbstractClassTypeDescriptor<Map.Entry> {
/**
* Singleton access
*/

Some files were not shown because too many files have changed in this diff Show More