HHH-16935 Fix inconsistent method name

This commit is contained in:
Yanming Zhou 2023-07-27 12:09:23 +08:00 committed by Christian Beikov
parent 7c94f5c6f6
commit f309a88552
15 changed files with 39 additions and 29 deletions

View File

@ -971,7 +971,7 @@ public class MetadataBuilderImpl implements MetadataBuilderImplementor, TypeCont
} }
@Override @Override
public boolean disallowExtensionsInCdi() { public boolean isAllowExtensionsInCdi() {
return allowExtensionsInCdi; return allowExtensionsInCdi;
} }

View File

@ -300,7 +300,7 @@ public class TypeDefinition implements Serializable {
String name, String name,
Class<T> typeImplementorClass, Class<T> typeImplementorClass,
BeanInstanceProducer instanceProducer) { BeanInstanceProducer instanceProducer) {
if ( buildingOptions.disallowExtensionsInCdi() ) { if ( !buildingOptions.isAllowExtensionsInCdi() ) {
return name != null return name != null
? instanceProducer.produceBeanInstance( name, typeImplementorClass ) ? instanceProducer.produceBeanInstance( name, typeImplementorClass )
: instanceProducer.produceBeanInstance( typeImplementorClass ); : instanceProducer.produceBeanInstance( typeImplementorClass );

View File

@ -505,7 +505,7 @@ public final class AnnotationBinder {
ManagedBeanRegistry managedBeanRegistry, ManagedBeanRegistry managedBeanRegistry,
JdbcTypeRegistration annotation) { JdbcTypeRegistration annotation) {
final Class<? extends JdbcType> jdbcTypeClass = annotation.value(); final Class<? extends JdbcType> jdbcTypeClass = annotation.value();
final JdbcType jdbcType = context.getBuildingOptions().disallowExtensionsInCdi() final JdbcType jdbcType = !context.getBuildingOptions().isAllowExtensionsInCdi()
? FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( jdbcTypeClass ) ? FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( jdbcTypeClass )
: managedBeanRegistry.getBean( jdbcTypeClass ).getBeanInstance(); : managedBeanRegistry.getBean( jdbcTypeClass ).getBeanInstance();
final int typeCode = annotation.registrationCode() == Integer.MIN_VALUE final int typeCode = annotation.registrationCode() == Integer.MIN_VALUE
@ -520,7 +520,7 @@ public final class AnnotationBinder {
JavaTypeRegistration annotation) { JavaTypeRegistration annotation) {
final Class<? extends BasicJavaType<?>> javaTypeClass = annotation.descriptorClass(); final Class<? extends BasicJavaType<?>> javaTypeClass = annotation.descriptorClass();
final BasicJavaType<?> javaType = final BasicJavaType<?> javaType =
context.getBuildingOptions().disallowExtensionsInCdi() !context.getBuildingOptions().isAllowExtensionsInCdi()
? FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( javaTypeClass ) ? FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( javaTypeClass )
: managedBeanRegistry.getBean( javaTypeClass ).getBeanInstance(); : managedBeanRegistry.getBean( javaTypeClass ).getBeanInstance();
context.getMetadataCollector().addJavaTypeRegistration( annotation.javaType(), javaType ); context.getMetadataCollector().addJavaTypeRegistration( annotation.javaType(), javaType );
@ -752,7 +752,7 @@ public final class AnnotationBinder {
} }
private static JdbcMapping resolveUserType(Class<UserType<?>> userTypeClass, MetadataBuildingContext context) { private static JdbcMapping resolveUserType(Class<UserType<?>> userTypeClass, MetadataBuildingContext context) {
final UserType<?> userType = context.getBuildingOptions().disallowExtensionsInCdi() final UserType<?> userType = !context.getBuildingOptions().isAllowExtensionsInCdi()
? FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( userTypeClass ) ? FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( userTypeClass )
: context.getBootstrapContext().getServiceRegistry() : context.getBootstrapContext().getServiceRegistry()
.requireService( ManagedBeanRegistry.class ) .requireService( ManagedBeanRegistry.class )
@ -809,7 +809,7 @@ public final class AnnotationBinder {
return registeredJtd; return registeredJtd;
} }
if ( context.getBuildingOptions().disallowExtensionsInCdi() ) { if ( !context.getBuildingOptions().isAllowExtensionsInCdi() ) {
return FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( javaTypeClass ); return FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( javaTypeClass );
} }

View File

@ -433,7 +433,7 @@ public class BasicValueBinder implements JdbcTypeIndicators {
throw new MappingException( "idbag mapping missing @CollectionId" ); throw new MappingException( "idbag mapping missing @CollectionId" );
} }
final boolean useDeferredBeanContainerAccess = buildingContext.getBuildingOptions().disallowExtensionsInCdi(); final boolean useDeferredBeanContainerAccess = !buildingContext.getBuildingOptions().isAllowExtensionsInCdi();
final ManagedBeanRegistry beanRegistry = getManagedBeanRegistry(); final ManagedBeanRegistry beanRegistry = getManagedBeanRegistry();
explicitBasicTypeName = null; explicitBasicTypeName = null;
@ -556,7 +556,7 @@ public class BasicValueBinder implements JdbcTypeIndicators {
temporalPrecision = mapKeyTemporalAnn.value(); temporalPrecision = mapKeyTemporalAnn.value();
} }
final boolean useDeferredBeanContainerAccess = buildingContext.getBuildingOptions().disallowExtensionsInCdi(); final boolean useDeferredBeanContainerAccess = !buildingContext.getBuildingOptions().isAllowExtensionsInCdi();
explicitJdbcTypeAccess = typeConfiguration -> { explicitJdbcTypeAccess = typeConfiguration -> {
final MapKeyJdbcType jdbcTypeAnn = findAnnotation( mapAttribute, MapKeyJdbcType.class ); final MapKeyJdbcType jdbcTypeAnn = findAnnotation( mapAttribute, MapKeyJdbcType.class );
@ -659,7 +659,7 @@ public class BasicValueBinder implements JdbcTypeIndicators {
private void prepareListIndex(XProperty listAttribute) { private void prepareListIndex(XProperty listAttribute) {
implicitJavaTypeAccess = typeConfiguration -> Integer.class; implicitJavaTypeAccess = typeConfiguration -> Integer.class;
final boolean useDeferredBeanContainerAccess = buildingContext.getBuildingOptions().disallowExtensionsInCdi(); final boolean useDeferredBeanContainerAccess = !buildingContext.getBuildingOptions().isAllowExtensionsInCdi();
final ManagedBeanRegistry beanRegistry = buildingContext final ManagedBeanRegistry beanRegistry = buildingContext
.getBootstrapContext() .getBootstrapContext()
.getServiceRegistry() .getServiceRegistry()
@ -874,7 +874,7 @@ public class BasicValueBinder implements JdbcTypeIndicators {
private void prepareAnyKey(XProperty modelXProperty) { private void prepareAnyKey(XProperty modelXProperty) {
implicitJavaTypeAccess = (typeConfiguration) -> null; implicitJavaTypeAccess = (typeConfiguration) -> null;
final boolean useDeferredBeanContainerAccess = buildingContext.getBuildingOptions().disallowExtensionsInCdi(); final boolean useDeferredBeanContainerAccess = !buildingContext.getBuildingOptions().isAllowExtensionsInCdi();
explicitJavaTypeAccess = (typeConfiguration) -> { explicitJavaTypeAccess = (typeConfiguration) -> {
final AnyKeyJavaType javaTypeAnn = findAnnotation( modelXProperty, AnyKeyJavaType.class ); final AnyKeyJavaType javaTypeAnn = findAnnotation( modelXProperty, AnyKeyJavaType.class );
@ -931,7 +931,7 @@ public class BasicValueBinder implements JdbcTypeIndicators {
if ( jdbcTypeAnn != null ) { if ( jdbcTypeAnn != null ) {
final Class<? extends JdbcType> jdbcTypeClass = normalizeJdbcType( jdbcTypeAnn.value() ); final Class<? extends JdbcType> jdbcTypeClass = normalizeJdbcType( jdbcTypeAnn.value() );
if ( jdbcTypeClass != null ) { if ( jdbcTypeClass != null ) {
if ( buildingContext.getBuildingOptions().disallowExtensionsInCdi() ) { if ( !buildingContext.getBuildingOptions().isAllowExtensionsInCdi() ) {
return FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( jdbcTypeClass ); return FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( jdbcTypeClass );
} }
return getManagedBeanRegistry().getBean( jdbcTypeClass ).getBeanInstance(); return getManagedBeanRegistry().getBean( jdbcTypeClass ).getBeanInstance();
@ -1050,7 +1050,7 @@ public class BasicValueBinder implements JdbcTypeIndicators {
return ImmutableMutabilityPlan.instance(); return ImmutableMutabilityPlan.instance();
} }
if ( buildingContext.getBuildingOptions().disallowExtensionsInCdi() ) { if ( !buildingContext.getBuildingOptions().isAllowExtensionsInCdi() ) {
return FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( mutability ); return FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( mutability );
} }
@ -1065,7 +1065,7 @@ public class BasicValueBinder implements JdbcTypeIndicators {
if ( javaType != null ) { if ( javaType != null ) {
final Class<? extends BasicJavaType<?>> javaTypeClass = normalizeJavaType( javaType.value() ); final Class<? extends BasicJavaType<?>> javaTypeClass = normalizeJavaType( javaType.value() );
if ( javaTypeClass != null ) { if ( javaTypeClass != null ) {
if ( buildingContext.getBuildingOptions().disallowExtensionsInCdi() ) { if ( !buildingContext.getBuildingOptions().isAllowExtensionsInCdi() ) {
return FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( javaTypeClass ); return FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( javaTypeClass );
} }
return getManagedBeanRegistry().getBean( javaTypeClass ).getBeanInstance(); return getManagedBeanRegistry().getBean( javaTypeClass ).getBeanInstance();

View File

@ -881,7 +881,7 @@ public abstract class CollectionBinder {
Map<String,String> parameters, Map<String,String> parameters,
MetadataBuildingContext buildingContext) { MetadataBuildingContext buildingContext) {
final boolean hasParameters = CollectionHelper.isNotEmpty( parameters ); final boolean hasParameters = CollectionHelper.isNotEmpty( parameters );
if ( buildingContext.getBuildingOptions().disallowExtensionsInCdi() ) { if ( !buildingContext.getBuildingOptions().isAllowExtensionsInCdi() ) {
// if deferred container access is enabled, we locally create the user-type // if deferred container access is enabled, we locally create the user-type
return MappingHelper.createLocalUserCollectionTypeBean( role, implementation, hasParameters, parameters ); return MappingHelper.createLocalUserCollectionTypeBean( role, implementation, hasParameters, parameters );
} }

View File

@ -409,7 +409,7 @@ public class EmbeddableBinder {
private static CompositeUserType<?> compositeUserType( private static CompositeUserType<?> compositeUserType(
Class<? extends CompositeUserType<?>> compositeUserTypeClass, Class<? extends CompositeUserType<?>> compositeUserTypeClass,
MetadataBuildingContext context) { MetadataBuildingContext context) {
if ( context.getBuildingOptions().disallowExtensionsInCdi() ) { if ( !context.getBuildingOptions().isAllowExtensionsInCdi() ) {
FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( compositeUserTypeClass ); FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( compositeUserTypeClass );
} }

View File

@ -2410,7 +2410,7 @@ public class ModelBinder {
} }
private Object typeInstance(String typeName, Class<?> typeJavaType) { private Object typeInstance(String typeName, Class<?> typeJavaType) {
if ( metadataBuildingContext.getBuildingOptions().disallowExtensionsInCdi() ) { if ( !metadataBuildingContext.getBuildingOptions().isAllowExtensionsInCdi() ) {
return FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( typeJavaType ); return FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( typeJavaType );
} }
else { else {
@ -2621,7 +2621,7 @@ public class ModelBinder {
if ( CompositeUserType.class.isAssignableFrom( componentClass ) ) { if ( CompositeUserType.class.isAssignableFrom( componentClass ) ) {
componentBinding.setTypeName( explicitComponentClassName ); componentBinding.setTypeName( explicitComponentClassName );
CompositeUserType<?> compositeUserType; CompositeUserType<?> compositeUserType;
if ( sourceDocument.getBuildingOptions().disallowExtensionsInCdi() ) { if ( !sourceDocument.getBuildingOptions().isAllowExtensionsInCdi() ) {
compositeUserType = (CompositeUserType<?>) FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( componentClass ); compositeUserType = (CompositeUserType<?>) FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( componentClass );
} }
else { else {

View File

@ -178,7 +178,7 @@ public abstract class AbstractDelegatingMetadataBuildingOptions implements Metad
} }
@Override @Override
public boolean disallowExtensionsInCdi() { public boolean isAllowExtensionsInCdi() {
return delegate.disallowExtensionsInCdi(); return delegate.isAllowExtensionsInCdi();
} }
} }

View File

@ -243,5 +243,15 @@ public interface MetadataBuildingOptions {
/** /**
* Check to see if extensions can be hosted in CDI * Check to see if extensions can be hosted in CDI
*/ */
boolean disallowExtensionsInCdi(); boolean isAllowExtensionsInCdi();
/**
* Check to see if extensions can be hosted in CDI
*
* @deprecated Use {@link #isAllowExtensionsInCdi()}
*/
@Deprecated(forRemoval = true)
default boolean disallowExtensionsInCdi() {
return !isAllowExtensionsInCdi();
}
} }

View File

@ -843,7 +843,7 @@ public class BasicValue extends SimpleValue implements JdbcTypeIndicators, Resol
private UserType<?> getConfiguredUserTypeBean(Class<? extends UserType<?>> explicitCustomType, Properties properties) { private UserType<?> getConfiguredUserTypeBean(Class<? extends UserType<?>> explicitCustomType, Properties properties) {
final UserType<?> typeInstance = final UserType<?> typeInstance =
getBuildingContext().getBuildingOptions().disallowExtensionsInCdi() !getBuildingContext().getBuildingOptions().isAllowExtensionsInCdi()
? FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( explicitCustomType ) ? FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( explicitCustomType )
: getUserTypeBean( explicitCustomType, properties ).getBeanInstance(); : getUserTypeBean( explicitCustomType, properties ).getBeanInstance();

View File

@ -341,7 +341,7 @@ public class Component extends SimpleValue implements MetaAttributable, Sortable
final BootstrapContext bootstrapContext = getBuildingContext().getBootstrapContext(); final BootstrapContext bootstrapContext = getBuildingContext().getBootstrapContext();
final Class<CompositeUserType<?>> customTypeClass = final Class<CompositeUserType<?>> customTypeClass =
bootstrapContext.getClassLoaderAccess().classForName( component.getTypeName() ); bootstrapContext.getClassLoaderAccess().classForName( component.getTypeName() );
return getBuildingContext().getBuildingOptions().disallowExtensionsInCdi() return !getBuildingContext().getBuildingOptions().isAllowExtensionsInCdi()
? FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( customTypeClass ) ? FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( customTypeClass )
: bootstrapContext.getServiceRegistry().requireService( ManagedBeanRegistry.class ) : bootstrapContext.getServiceRegistry().requireService( ManagedBeanRegistry.class )
.getBean( customTypeClass ).getBeanInstance(); .getBean( customTypeClass ).getBeanInstance();

View File

@ -60,7 +60,7 @@ public final class MappingHelper {
final boolean hasParameters = CollectionHelper.isNotEmpty( typeParameters ); final boolean hasParameters = CollectionHelper.isNotEmpty( typeParameters );
final ManagedBean<? extends UserCollectionType> userTypeBean; final ManagedBean<? extends UserCollectionType> userTypeBean;
if ( metadata.getMetadataBuildingOptions().disallowExtensionsInCdi() ) { if ( !metadata.getMetadataBuildingOptions().isAllowExtensionsInCdi() ) {
//noinspection unchecked,rawtypes //noinspection unchecked,rawtypes
userTypeBean = createLocalUserCollectionTypeBean( userTypeBean = createLocalUserCollectionTypeBean(
role, role,

View File

@ -82,7 +82,7 @@ public class ManagedTypeRepresentationResolverStandard implements ManagedTypeRep
final Class<CompositeUserType<?>> userTypeClass = creationContext.getBootstrapContext() final Class<CompositeUserType<?>> userTypeClass = creationContext.getBootstrapContext()
.getClassLoaderAccess() .getClassLoaderAccess()
.classForName( bootDescriptor.getTypeName() ); .classForName( bootDescriptor.getTypeName() );
if ( creationContext.getBootModel().getMetadataBuildingOptions().disallowExtensionsInCdi() ) { if ( !creationContext.getBootModel().getMetadataBuildingOptions().isAllowExtensionsInCdi() ) {
compositeUserType = FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( userTypeClass ); compositeUserType = FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( userTypeClass );
} }
else { else {
@ -99,7 +99,7 @@ public class ManagedTypeRepresentationResolverStandard implements ManagedTypeRep
final EmbeddableInstantiator customInstantiator; final EmbeddableInstantiator customInstantiator;
if ( bootDescriptor.getCustomInstantiator() != null ) { if ( bootDescriptor.getCustomInstantiator() != null ) {
final Class<? extends EmbeddableInstantiator> instantiatorClass = bootDescriptor.getCustomInstantiator(); final Class<? extends EmbeddableInstantiator> instantiatorClass = bootDescriptor.getCustomInstantiator();
if ( creationContext.getBootModel().getMetadataBuildingOptions().disallowExtensionsInCdi() ) { if ( !creationContext.getBootModel().getMetadataBuildingOptions().isAllowExtensionsInCdi() ) {
customInstantiator = FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( instantiatorClass ); customInstantiator = FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( instantiatorClass );
} }
else { else {

View File

@ -497,7 +497,7 @@ public class TypeConfiguration implements SessionFactoryObserver, Serializable {
private void setMetadataBuildingContext(MetadataBuildingContext metadataBuildingContext) { private void setMetadataBuildingContext(MetadataBuildingContext metadataBuildingContext) {
this.metadataBuildingContext = metadataBuildingContext; this.metadataBuildingContext = metadataBuildingContext;
if ( metadataBuildingContext != null ) { if ( metadataBuildingContext != null ) {
this.allowExtensionsInCdi = metadataBuildingContext.getBuildingOptions().disallowExtensionsInCdi(); this.allowExtensionsInCdi = metadataBuildingContext.getBuildingOptions().isAllowExtensionsInCdi();
} }
} }
@ -814,7 +814,7 @@ public class TypeConfiguration implements SessionFactoryObserver, Serializable {
@Internal @SuppressWarnings("unchecked") @Internal @SuppressWarnings("unchecked")
public <J> MutabilityPlan<J> createMutabilityPlan(Class<? extends MutabilityPlan<?>> planClass) { public <J> MutabilityPlan<J> createMutabilityPlan(Class<? extends MutabilityPlan<?>> planClass) {
if ( scope.allowExtensionsInCdi ) { if ( !scope.allowExtensionsInCdi ) {
//noinspection rawtypes //noinspection rawtypes
return (MutabilityPlan) FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( planClass ); return (MutabilityPlan) FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( planClass );
} }

View File

@ -53,7 +53,7 @@ public final class ComponentMetadataGenerator extends AbstractMetadataGenerator
final Component propComponent = (Component) value; final Component propComponent = (Component) value;
final EmbeddableInstantiator instantiator; final EmbeddableInstantiator instantiator;
if ( propComponent.getCustomInstantiator() != null ) { if ( propComponent.getCustomInstantiator() != null ) {
if ( getMetadataBuildingContext().getBuildingOptions().disallowExtensionsInCdi() ) { if ( !getMetadataBuildingContext().getBuildingOptions().isAllowExtensionsInCdi() ) {
instantiator = FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( propComponent.getCustomInstantiator() ); instantiator = FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( propComponent.getCustomInstantiator() );
} }
else { else {
@ -68,7 +68,7 @@ public final class ComponentMetadataGenerator extends AbstractMetadataGenerator
final Class<CompositeUserType<?>> userTypeClass = getMetadataBuildingContext().getBootstrapContext() final Class<CompositeUserType<?>> userTypeClass = getMetadataBuildingContext().getBootstrapContext()
.getClassLoaderAccess() .getClassLoaderAccess()
.classForName( propComponent.getTypeName() ); .classForName( propComponent.getTypeName() );
if ( getMetadataBuildingContext().getBuildingOptions().disallowExtensionsInCdi() ) { if ( !getMetadataBuildingContext().getBuildingOptions().isAllowExtensionsInCdi() ) {
final CompositeUserType<?> compositeUserType = FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( userTypeClass ); final CompositeUserType<?> compositeUserType = FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( userTypeClass );
//noinspection rawtypes //noinspection rawtypes
instantiator = new EmbeddableCompositeUserTypeInstantiator( (CompositeUserType) compositeUserType ); instantiator = new EmbeddableCompositeUserTypeInstantiator( (CompositeUserType) compositeUserType );