org.hibernate.mapping.BasicValue Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of beangle-hibernate-core Show documentation
Show all versions of beangle-hibernate-core Show documentation
Hibernate Orm Core Shade,Support Scala Collection
/*
* 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.mapping;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.function.Consumer;
import java.util.function.Function;
import org.hibernate.Incubating;
import org.hibernate.Internal;
import org.hibernate.MappingException;
import org.hibernate.TimeZoneStorageStrategy;
import org.hibernate.annotations.SoftDelete;
import org.hibernate.annotations.SoftDeleteType;
import org.hibernate.annotations.TimeZoneStorageType;
import org.hibernate.boot.model.TypeDefinition;
import org.hibernate.boot.model.convert.internal.AutoApplicableConverterDescriptorBypassedImpl;
import org.hibernate.boot.model.convert.internal.ClassBasedConverterDescriptor;
import org.hibernate.boot.model.convert.internal.InstanceBasedConverterDescriptor;
import org.hibernate.boot.model.convert.spi.AutoApplicableConverterDescriptor;
import org.hibernate.boot.model.convert.spi.ConverterDescriptor;
import org.hibernate.boot.model.convert.spi.JpaAttributeConverterCreationContext;
import org.hibernate.boot.model.process.internal.InferredBasicValueResolution;
import org.hibernate.boot.model.process.internal.InferredBasicValueResolver;
import org.hibernate.boot.model.process.internal.NamedBasicTypeResolution;
import org.hibernate.boot.model.process.internal.NamedConverterResolution;
import org.hibernate.boot.model.process.internal.UserTypeResolution;
import org.hibernate.boot.model.process.internal.VersionResolution;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;
import org.hibernate.boot.spi.MetadataBuildingContext;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.jdbc.Size;
import org.hibernate.internal.CoreLogging;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.internal.util.collections.CollectionHelper;
import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.metamodel.mapping.SelectablePath;
import org.hibernate.resource.beans.internal.FallbackBeanInstanceProducer;
import org.hibernate.resource.beans.spi.BeanInstanceProducer;
import org.hibernate.resource.beans.spi.ManagedBean;
import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
import org.hibernate.tool.schema.extract.spi.ColumnTypeInformation;
import org.hibernate.type.BasicType;
import org.hibernate.type.CustomType;
import org.hibernate.type.NumericBooleanConverter;
import org.hibernate.type.SqlTypes;
import org.hibernate.type.TrueFalseConverter;
import org.hibernate.type.Type;
import org.hibernate.type.WrapperArrayHandling;
import org.hibernate.type.descriptor.converter.spi.BasicValueConverter;
import org.hibernate.type.descriptor.converter.spi.JpaAttributeConverter;
import org.hibernate.type.descriptor.java.BasicJavaType;
import org.hibernate.type.descriptor.java.BasicPluralJavaType;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.java.MutabilityPlan;
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
import org.hibernate.type.descriptor.java.spi.JsonJavaType;
import org.hibernate.type.descriptor.java.spi.RegistryHelper;
import org.hibernate.type.descriptor.java.spi.XmlJavaType;
import org.hibernate.type.descriptor.jdbc.BooleanJdbcType;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators;
import org.hibernate.type.internal.BasicTypeImpl;
import org.hibernate.type.spi.TypeConfiguration;
import org.hibernate.type.spi.TypeConfigurationAware;
import org.hibernate.usertype.DynamicParameterizedType;
import org.hibernate.usertype.UserType;
import com.fasterxml.classmate.ResolvedType;
import jakarta.persistence.AttributeConverter;
import jakarta.persistence.EnumType;
import jakarta.persistence.TemporalType;
import static java.lang.Boolean.parseBoolean;
import static org.hibernate.internal.util.ReflectHelper.reflectedPropertyType;
import static org.hibernate.internal.util.collections.CollectionHelper.isNotEmpty;
import static org.hibernate.mapping.MappingHelper.injectParameters;
/**
* @author Steve Ebersole
*/
public class BasicValue extends SimpleValue implements JdbcTypeIndicators, Resolvable, JpaAttributeConverterCreationContext {
private static final CoreMessageLogger log = CoreLogging.messageLogger( BasicValue.class );
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// incoming "configuration" values
private String explicitTypeName;
private Map explicitLocalTypeParams;
private Function explicitJavaTypeAccess;
private Function explicitJdbcTypeAccess;
private Function explicitMutabilityPlanAccess;
private Function implicitJavaTypeAccess;
private EnumType enumerationStyle;
@SuppressWarnings("deprecation")
private TemporalType temporalPrecision;
private TimeZoneStorageType timeZoneStorageType;
private boolean isSoftDelete;
private SoftDeleteType softDeleteStrategy;
private java.lang.reflect.Type resolvedJavaType;
private String ownerName;
private String propertyName;
private AggregateColumn aggregateColumn;
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Resolved state - available after `#resolve`
private Resolution> resolution;
private Integer jdbcTypeCode;
public BasicValue(MetadataBuildingContext buildingContext) {
this( buildingContext, null );
}
public BasicValue(MetadataBuildingContext buildingContext, Table table) {
super( buildingContext, table );
buildingContext.getMetadataCollector().registerValueMappingResolver( this::resolve );
}
public BasicValue(BasicValue original) {
super( original );
this.explicitTypeName = original.explicitTypeName;
this.explicitLocalTypeParams = original.explicitLocalTypeParams == null
? null
: new HashMap<>(original.explicitLocalTypeParams);
this.explicitJavaTypeAccess = original.explicitJavaTypeAccess;
this.explicitJdbcTypeAccess = original.explicitJdbcTypeAccess;
this.explicitMutabilityPlanAccess = original.explicitMutabilityPlanAccess;
this.implicitJavaTypeAccess = original.implicitJavaTypeAccess;
this.enumerationStyle = original.enumerationStyle;
this.temporalPrecision = original.temporalPrecision;
this.timeZoneStorageType = original.timeZoneStorageType;
this.resolvedJavaType = original.resolvedJavaType;
this.ownerName = original.ownerName;
this.propertyName = original.propertyName;
}
@Override
public BasicValue copy() {
return new BasicValue( this );
}
public boolean isSoftDelete() {
return isSoftDelete;
}
public SoftDeleteType getSoftDeleteStrategy() {
return softDeleteStrategy;
}
public void makeSoftDelete(SoftDeleteType strategy) {
isSoftDelete = true;
softDeleteStrategy = strategy;
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Setters - in preparation of resolution
@Override
public void setTypeUsingReflection(String className, String propertyName) throws MappingException {
if ( resolution != null ) {
throw new IllegalStateException( "BasicValue already resolved" );
}
this.ownerName = className;
this.propertyName = propertyName;
super.setTypeUsingReflection( className, propertyName );
}
public void setEnumerationStyle(EnumType enumerationStyle) {
this.enumerationStyle = enumerationStyle;
}
public EnumType getEnumerationStyle() {
return enumerationStyle;
}
public TimeZoneStorageType getTimeZoneStorageType() {
return timeZoneStorageType;
}
public void setTimeZoneStorageType(TimeZoneStorageType timeZoneStorageType) {
this.timeZoneStorageType = timeZoneStorageType;
}
public void setJpaAttributeConverterDescriptor(ConverterDescriptor descriptor) {
setAttributeConverterDescriptor( descriptor );
super.setJpaAttributeConverterDescriptor( descriptor );
}
@SuppressWarnings("rawtypes")
public void setExplicitJavaTypeAccess(Function explicitJavaTypeAccess) {
this.explicitJavaTypeAccess = explicitJavaTypeAccess;
}
public void setExplicitJdbcTypeAccess(Function jdbcTypeAccess) {
this.explicitJdbcTypeAccess = jdbcTypeAccess;
}
public void setExplicitMutabilityPlanAccess(Function explicitMutabilityPlanAccess) {
this.explicitMutabilityPlanAccess = explicitMutabilityPlanAccess;
}
public void setImplicitJavaTypeAccess(Function implicitJavaTypeAccess) {
this.implicitJavaTypeAccess = implicitJavaTypeAccess;
}
public Selectable getColumn() {
if ( getColumnSpan() == 0 ) {
return null;
}
return getColumn( 0 );
}
public java.lang.reflect.Type getResolvedJavaType() {
return resolvedJavaType;
}
@Override
public long getColumnLength() {
final Selectable selectable = getColumn();
if ( selectable instanceof Column ) {
final Long length = ( (Column) selectable ).getLength();
return length == null ? NO_COLUMN_LENGTH : length;
}
else {
return NO_COLUMN_LENGTH;
}
}
@Override
public int getColumnPrecision() {
final Selectable selectable = getColumn();
if ( selectable instanceof Column ) {
final Column column = (Column) selectable;
final Integer temporalPrecision = column.getTemporalPrecision();
if ( temporalPrecision != null ) {
return temporalPrecision;
}
final Integer precision = column.getPrecision();
return precision == null ? NO_COLUMN_PRECISION : precision;
}
else {
return NO_COLUMN_PRECISION;
}
}
@Override
public int getColumnScale() {
final Selectable selectable = getColumn();
if ( selectable instanceof Column ) {
final Integer scale = ( (Column) selectable ).getScale();
return scale == null ? NO_COLUMN_SCALE : scale;
}
else {
return NO_COLUMN_SCALE;
}
}
@Override
public void addColumn(Column incomingColumn) {
super.addColumn( incomingColumn );
checkSelectable( incomingColumn );
}
@Override
public void copyTypeFrom(SimpleValue sourceValue) {
super.copyTypeFrom( sourceValue );
if ( sourceValue instanceof BasicValue ) {
final BasicValue basicValue = (BasicValue) sourceValue;
resolution = basicValue.resolution;
implicitJavaTypeAccess =
typeConfiguration -> basicValue.implicitJavaTypeAccess.apply( typeConfiguration );
}
}
private void checkSelectable(Selectable incomingColumn) {
if ( incomingColumn == null ) {
throw new IllegalArgumentException( "Incoming column was null" );
}
final Selectable column = getColumn();
if ( column == incomingColumn || column.getText().equals( incomingColumn.getText() ) ) {
log.debugf( "Skipping column re-registration: %s.%s", getTable().getName(), column.getText() );
}
// else {
// throw new IllegalStateException(
// "BasicValue [" + ownerName + "." + propertyName +
// "] already had column associated: `" + column.getText() +
// "` -> `" + incomingColumn.getText() + "`"
// );
// }
}
@Override
public void addColumn(Column incomingColumn, boolean isInsertable, boolean isUpdatable) {
super.addColumn( incomingColumn, isInsertable, isUpdatable );
checkSelectable( incomingColumn );
}
@Override
public void addFormula(Formula formula) {
super.addFormula( formula );
checkSelectable( formula );
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Resolution
@Override
public Type getType() throws MappingException {
resolve();
assert getResolution() != null;
return getResolution().getLegacyResolvedBasicType();
}
public Resolution> getResolution() {
return resolution;
}
@Override
public boolean resolve(MetadataBuildingContext buildingContext) {
resolve();
return true;
}
@Override
public Resolution> resolve() {
if ( resolution != null ) {
return resolution;
}
resolution = buildResolution();
if ( resolution == null ) {
throw new IllegalStateException( "Unable to resolve BasicValue : " + this );
}
final Selectable selectable = getColumn();
final Size size;
if ( selectable instanceof Column ) {
Column column = (Column) selectable;
resolveColumn( column, getDialect() );
size = column.calculateColumnSize( getDialect(), getBuildingContext().getMetadataCollector() );
}
else {
size = Size.nil();
}
resolution.getJdbcType()
.addAuxiliaryDatabaseObjects(
resolution.getRelationalJavaType(),
size,
getBuildingContext().getMetadataCollector().getDatabase(),
this
);
return resolution;
}
@Override
public String getExtraCreateTableInfo() {
return resolution.getJdbcType()
.getExtraCreateTableInfo(
resolution.getRelationalJavaType(),
getColumn().getText(),
getTable().getName(),
getBuildingContext().getMetadataCollector().getDatabase()
);
}
@Override
public Dialect getDialect() {
return getMetadata().getDatabase().getDialect();
}
private void resolveColumn(Column column, Dialect dialect) {
if ( column.getSqlTypeCode() == null ) {
column.setSqlTypeCode( resolution.getJdbcType().getDdlTypeCode() );
}
// final String declaration = resolution.getLegacyResolvedBasicType().getSpecializedTypeDeclaration( dialect );
// if ( declaration != null ) {
// column.setSpecializedTypeDeclaration( declaration );
// }
if ( dialect.supportsColumnCheck() ) {
final String checkCondition = resolution.getLegacyResolvedBasicType()
.getCheckCondition( column.getQuotedName( dialect ), dialect );
if ( checkCondition != null ) {
column.addCheckConstraint( new CheckConstraint( checkCondition ) );
}
}
}
public AggregateColumn getAggregateColumn() {
return aggregateColumn;
}
public void setAggregateColumn(AggregateColumn aggregateColumn) {
this.aggregateColumn = aggregateColumn;
}
public SelectablePath createSelectablePath(String selectableName) {
if ( aggregateColumn != null ) {
return aggregateColumn.getSelectablePath().append( selectableName );
}
return new SelectablePath( selectableName );
}
protected Resolution> buildResolution() {
final Properties typeParameters = getTypeParameters();
if ( typeParameters != null
&& parseBoolean( typeParameters.getProperty(DynamicParameterizedType.IS_DYNAMIC) )
&& typeParameters.get(DynamicParameterizedType.PARAMETER_TYPE) == null ) {
createParameterImpl();
}
if ( explicitTypeName != null ) {
return interpretExplicitlyNamedType(
explicitTypeName,
explicitJavaTypeAccess,
explicitJdbcTypeAccess,
explicitMutabilityPlanAccess,
getAttributeConverterDescriptor(),
typeParameters,
this::setTypeParameters,
this,
getBuildingContext()
);
}
else if ( isVersion() ) {
return VersionResolution.from( implicitJavaTypeAccess, timeZoneStorageType, getBuildingContext() );
}
else {
// determine JavaType if we can
final BasicJavaType> explicitJavaType = getExplicitJavaType();
final JavaType> javaType = determineJavaType( explicitJavaType );
final ConverterDescriptor converterDescriptor = getConverterDescriptor( javaType );
return converterDescriptor != null
? converterResolution( javaType, converterDescriptor )
: resolution( explicitJavaType, javaType );
}
}
private BasicJavaType> getExplicitJavaType() {
return explicitJavaTypeAccess == null ? null
: explicitJavaTypeAccess.apply( getTypeConfiguration() );
}
private ConverterDescriptor getConverterDescriptor(JavaType> javaType) {
final ConverterDescriptor converterDescriptor = getAttributeConverterDescriptor();
if ( isSoftDelete() ) {
assert converterDescriptor != null;
final ConverterDescriptor softDeleteConverterDescriptor =
getSoftDeleteConverterDescriptor( converterDescriptor, javaType);
return getSoftDeleteStrategy() == SoftDeleteType.ACTIVE
? new ReversedConverterDescriptor<>( softDeleteConverterDescriptor )
: softDeleteConverterDescriptor;
}
else {
return converterDescriptor;
}
}
private ConverterDescriptor getSoftDeleteConverterDescriptor(
ConverterDescriptor attributeConverterDescriptor, JavaType> javaType) {
final boolean conversionWasUnspecified =
SoftDelete.UnspecifiedConversion.class.equals( attributeConverterDescriptor.getAttributeConverterClass() );
if ( conversionWasUnspecified ) {
final JdbcType jdbcType = BooleanJdbcType.INSTANCE.resolveIndicatedType( this, javaType);
if ( jdbcType.isNumber() ) {
return new InstanceBasedConverterDescriptor(
NumericBooleanConverter.INSTANCE,
getBuildingContext().getBootstrapContext().getClassmateContext()
);
}
else if ( jdbcType.isString() ) {
// here we pick 'T' / 'F' storage, though 'Y' / 'N' is equally valid - its 50/50
return new InstanceBasedConverterDescriptor(
TrueFalseConverter.INSTANCE,
getBuildingContext().getBootstrapContext().getClassmateContext()
);
}
else {
// should indicate BIT or BOOLEAN == no conversion needed
// - we still create the converter to properly set up JDBC type, etc
return new InstanceBasedConverterDescriptor(
PassThruSoftDeleteConverter.INSTANCE,
getBuildingContext().getBootstrapContext().getClassmateContext()
);
}
}
else {
return attributeConverterDescriptor;
}
}
private static class ReversedConverterDescriptor implements ConverterDescriptor {
private final ConverterDescriptor underlyingDescriptor;
public ReversedConverterDescriptor(ConverterDescriptor underlyingDescriptor) {
this.underlyingDescriptor = underlyingDescriptor;
}
@Override
public Class extends AttributeConverter> getAttributeConverterClass() {
//noinspection unchecked
return (Class extends AttributeConverter>) getClass();
}
@Override
public ResolvedType getDomainValueResolvedType() {
return underlyingDescriptor.getDomainValueResolvedType();
}
@Override
public ResolvedType getRelationalValueResolvedType() {
return underlyingDescriptor.getRelationalValueResolvedType();
}
@Override
public AutoApplicableConverterDescriptor getAutoApplyDescriptor() {
return AutoApplicableConverterDescriptorBypassedImpl.INSTANCE;
}
@Override
public JpaAttributeConverter createJpaAttributeConverter(JpaAttributeConverterCreationContext context) {
//noinspection unchecked
return new ReversedJpaAttributeConverter<>(
(JpaAttributeConverter) underlyingDescriptor.createJpaAttributeConverter( context ),
context.getJavaTypeRegistry().getDescriptor( ReversedJpaAttributeConverter.class )
);
}
}
private static class ReversedJpaAttributeConverter>
implements JpaAttributeConverter, AttributeConverter, ManagedBean {
private final JpaAttributeConverter underlyingJpaConverter;
private final JavaType> converterJavaType;
public ReversedJpaAttributeConverter(
JpaAttributeConverter underlyingJpaConverter,
JavaType> converterJavaType) {
this.underlyingJpaConverter = underlyingJpaConverter;
this.converterJavaType = converterJavaType;
}
@Override
public Boolean toDomainValue(R relationalValue) {
return !underlyingJpaConverter.toDomainValue( relationalValue );
}
@Override
public R toRelationalValue(Boolean domainValue) {
return underlyingJpaConverter.toRelationalValue( domainValue != null ? !domainValue : null );
}
@Override
public Boolean convertToEntityAttribute(R relationalValue) {
return toDomainValue( relationalValue );
}
@Override
public R convertToDatabaseColumn(Boolean domainValue) {
return toRelationalValue( domainValue );
}
@Override
public JavaType getDomainJavaType() {
return underlyingJpaConverter.getDomainJavaType();
}
@Override
public JavaType getRelationalJavaType() {
return underlyingJpaConverter.getRelationalJavaType();
}
@Override
public JavaType extends AttributeConverter> getConverterJavaType() {
return converterJavaType;
}
@Override
public ManagedBean extends AttributeConverter> getConverterBean() {
return this;
}
@Override
public Class getBeanClass() {
//noinspection unchecked
return (Class) getClass();
}
@Override
public B getBeanInstance() {
//noinspection unchecked
return (B) this;
}
}
private static class PassThruSoftDeleteConverter implements AttributeConverter {
private static final PassThruSoftDeleteConverter INSTANCE = new PassThruSoftDeleteConverter();
@Override
public Boolean convertToDatabaseColumn(Boolean domainValue) {
return domainValue;
}
@Override
public Boolean convertToEntityAttribute(Boolean relationalValue) {
return relationalValue;
}
}
private Resolution> resolution(BasicJavaType explicitJavaType, JavaType> javaType) {
final JavaType> basicJavaType;
final JdbcType jdbcType;
if ( explicitJdbcTypeAccess != null ) {
final TypeConfiguration typeConfiguration = getTypeConfiguration();
jdbcType = explicitJdbcTypeAccess.apply( typeConfiguration );
basicJavaType = javaType == null && jdbcType != null
? jdbcType.getJdbcRecommendedJavaTypeMapping(null, null, typeConfiguration)
: javaType;
}
else {
jdbcType = null;
basicJavaType = javaType;
}
if ( basicJavaType == null ) {
throw new MappingException( "Unable to determine JavaType to use : " + this );
}
if ( basicJavaType instanceof BasicJavaType>
&& ( !basicJavaType.getJavaTypeClass().isEnum() || enumerationStyle == null ) ) {
final TypeDefinition autoAppliedTypeDef =
getBuildingContext().getTypeDefinitionRegistry()
.resolveAutoApplied( (BasicJavaType>) basicJavaType );
if ( autoAppliedTypeDef != null ) {
log.debug("BasicValue resolution matched auto-applied type-definition");
return autoAppliedTypeDef.resolve( getTypeParameters(), null, getBuildingContext(), this );
}
}
return InferredBasicValueResolver.from(
explicitJavaType,
jdbcType,
resolvedJavaType,
this::determineReflectedJavaType,
explicitMutabilityPlanAccess,
this,
getTable(),
getColumn(),
ownerName,
propertyName,
getBuildingContext()
);
}
@Override
public ManagedBeanRegistry getManagedBeanRegistry() {
return getServiceRegistry().requireService( ManagedBeanRegistry.class );
}
private Resolution> converterResolution(JavaType> javaType, ConverterDescriptor attributeConverterDescriptor) {
final NamedConverterResolution> converterResolution = NamedConverterResolution.from(
attributeConverterDescriptor,
explicitJavaTypeAccess,
explicitJdbcTypeAccess,
explicitMutabilityPlanAccess,
resolvedJavaType,
this,
this,
getBuildingContext()
);
if ( javaType instanceof BasicPluralJavaType>
&& !attributeConverterDescriptor.getDomainValueResolvedType().getErasedType()
.isAssignableFrom( javaType.getJavaTypeClass() ) ) {
// In this case, the converter applies to the element of a BasicPluralJavaType
final BasicType registeredElementType = converterResolution.getLegacyResolvedBasicType();
final Selectable column = getColumn();
final BasicType> registeredType = registeredElementType == null ? null
: ( (BasicPluralJavaType>) javaType ).resolveType(
getTypeConfiguration(),
getDialect(),
registeredElementType,
column instanceof ColumnTypeInformation ? (ColumnTypeInformation) column : null,
this
);
if ( registeredType != null ) {
getTypeConfiguration().getBasicTypeRegistry().register( registeredType );
return new InferredBasicValueResolution(
registeredType,
registeredType.getJavaTypeDescriptor(),
registeredType.getJavaTypeDescriptor(),
registeredType.getJdbcType(),
registeredType,
null
);
}
}
return converterResolution;
}
private JavaType> determineJavaType(JavaType> explicitJavaType) {
JavaType> javaType = explicitJavaType;
//
// if ( javaType == null ) {
// if ( implicitJavaTypeAccess != null ) {
// final java.lang.reflect.Type implicitJtd = implicitJavaTypeAccess.apply( getTypeConfiguration() );
// if ( implicitJtd != null ) {
// javaType = getTypeConfiguration().getJavaTypeRegistry().getDescriptor( implicitJtd );
// }
// }
// }
if ( javaType == null ) {
final JavaType> reflectedJtd = determineReflectedJavaType();
if ( reflectedJtd != null ) {
javaType = reflectedJtd;
}
}
return javaType;
}
private JavaType> determineReflectedJavaType() {
final TypeConfiguration typeConfiguration = getTypeConfiguration();
final java.lang.reflect.Type impliedJavaType = impliedJavaType( typeConfiguration );
if ( impliedJavaType == null ) {
return null;
}
else {
resolvedJavaType = impliedJavaType;
return javaType( typeConfiguration, impliedJavaType );
}
}
private java.lang.reflect.Type impliedJavaType(TypeConfiguration typeConfiguration) {
if ( resolvedJavaType != null ) {
return resolvedJavaType;
}
else if ( implicitJavaTypeAccess != null ) {
return implicitJavaTypeAccess.apply(typeConfiguration);
}
else if ( ownerName != null && propertyName != null ) {
return reflectedPropertyType( ownerName, propertyName,
getServiceRegistry().requireService( ClassLoaderService.class ) );
}
else {
return null;
}
}
private JavaType
© 2015 - 2024 Weber Informatics LLC | Privacy Policy