Skip to content

Commit

Permalink
HHH-16935 Fix inconsistent method name
Browse files Browse the repository at this point in the history
  • Loading branch information
quaff authored and beikov committed Oct 11, 2023
1 parent 7c94f5c commit f309a88
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ public boolean isXmlMappingEnabled() {
}

@Override
public boolean disallowExtensionsInCdi() {
public boolean isAllowExtensionsInCdi() {
return allowExtensionsInCdi;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ private static <T> T instantiateType(
String name,
Class<T> typeImplementorClass,
BeanInstanceProducer instanceProducer) {
if ( buildingOptions.disallowExtensionsInCdi() ) {
if ( !buildingOptions.isAllowExtensionsInCdi() ) {
return name != null
? instanceProducer.produceBeanInstance( name, typeImplementorClass )
: instanceProducer.produceBeanInstance( typeImplementorClass );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ private static void handleJdbcTypeRegistration(
ManagedBeanRegistry managedBeanRegistry,
JdbcTypeRegistration annotation) {
final Class<? extends JdbcType> jdbcTypeClass = annotation.value();
final JdbcType jdbcType = context.getBuildingOptions().disallowExtensionsInCdi()
final JdbcType jdbcType = !context.getBuildingOptions().isAllowExtensionsInCdi()
? FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( jdbcTypeClass )
: managedBeanRegistry.getBean( jdbcTypeClass ).getBeanInstance();
final int typeCode = annotation.registrationCode() == Integer.MIN_VALUE
Expand All @@ -520,7 +520,7 @@ private static void handleJavaTypeRegistration(
JavaTypeRegistration annotation) {
final Class<? extends BasicJavaType<?>> javaTypeClass = annotation.descriptorClass();
final BasicJavaType<?> javaType =
context.getBuildingOptions().disallowExtensionsInCdi()
!context.getBuildingOptions().isAllowExtensionsInCdi()
? FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( javaTypeClass )
: managedBeanRegistry.getBean( javaTypeClass ).getBeanInstance();
context.getMetadataCollector().addJavaTypeRegistration( annotation.javaType(), javaType );
Expand Down Expand Up @@ -752,7 +752,7 @@ public Dialect getDialect() {
}

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 )
: context.getBootstrapContext().getServiceRegistry()
.requireService( ManagedBeanRegistry.class )
Expand Down Expand Up @@ -809,7 +809,7 @@ private static JavaType<?> getJavaType(
return registeredJtd;
}

if ( context.getBuildingOptions().disallowExtensionsInCdi() ) {
if ( !context.getBuildingOptions().isAllowExtensionsInCdi() ) {
return FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( javaTypeClass );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ private void prepareCollectionId(XProperty modelXProperty) {
throw new MappingException( "idbag mapping missing @CollectionId" );
}

final boolean useDeferredBeanContainerAccess = buildingContext.getBuildingOptions().disallowExtensionsInCdi();
final boolean useDeferredBeanContainerAccess = !buildingContext.getBuildingOptions().isAllowExtensionsInCdi();
final ManagedBeanRegistry beanRegistry = getManagedBeanRegistry();

explicitBasicTypeName = null;
Expand Down Expand Up @@ -556,7 +556,7 @@ private void prepareMapKey(
temporalPrecision = mapKeyTemporalAnn.value();
}

final boolean useDeferredBeanContainerAccess = buildingContext.getBuildingOptions().disallowExtensionsInCdi();
final boolean useDeferredBeanContainerAccess = !buildingContext.getBuildingOptions().isAllowExtensionsInCdi();

explicitJdbcTypeAccess = typeConfiguration -> {
final MapKeyJdbcType jdbcTypeAnn = findAnnotation( mapAttribute, MapKeyJdbcType.class );
Expand Down Expand Up @@ -659,7 +659,7 @@ private void prepareMapKey(
private void prepareListIndex(XProperty listAttribute) {
implicitJavaTypeAccess = typeConfiguration -> Integer.class;

final boolean useDeferredBeanContainerAccess = buildingContext.getBuildingOptions().disallowExtensionsInCdi();
final boolean useDeferredBeanContainerAccess = !buildingContext.getBuildingOptions().isAllowExtensionsInCdi();
final ManagedBeanRegistry beanRegistry = buildingContext
.getBootstrapContext()
.getServiceRegistry()
Expand Down Expand Up @@ -874,7 +874,7 @@ private void prepareAnyDiscriminator(XProperty modelXProperty) {
private void prepareAnyKey(XProperty modelXProperty) {
implicitJavaTypeAccess = (typeConfiguration) -> null;

final boolean useDeferredBeanContainerAccess = buildingContext.getBuildingOptions().disallowExtensionsInCdi();
final boolean useDeferredBeanContainerAccess = !buildingContext.getBuildingOptions().isAllowExtensionsInCdi();

explicitJavaTypeAccess = (typeConfiguration) -> {
final AnyKeyJavaType javaTypeAnn = findAnnotation( modelXProperty, AnyKeyJavaType.class );
Expand Down Expand Up @@ -931,7 +931,7 @@ private void normalJdbcTypeDetails(XProperty attributeXProperty) {
if ( jdbcTypeAnn != null ) {
final Class<? extends JdbcType> jdbcTypeClass = normalizeJdbcType( jdbcTypeAnn.value() );
if ( jdbcTypeClass != null ) {
if ( buildingContext.getBuildingOptions().disallowExtensionsInCdi() ) {
if ( !buildingContext.getBuildingOptions().isAllowExtensionsInCdi() ) {
return FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( jdbcTypeClass );
}
return getManagedBeanRegistry().getBean( jdbcTypeClass ).getBeanInstance();
Expand Down Expand Up @@ -1050,7 +1050,7 @@ private <T> MutabilityPlan<T> resolveMutability(Class<? extends MutabilityPlan>
return ImmutableMutabilityPlan.instance();
}

if ( buildingContext.getBuildingOptions().disallowExtensionsInCdi() ) {
if ( !buildingContext.getBuildingOptions().isAllowExtensionsInCdi() ) {
return FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( mutability );
}

Expand All @@ -1065,7 +1065,7 @@ private void normalSupplementalDetails(XProperty attributeXProperty) {
if ( javaType != null ) {
final Class<? extends BasicJavaType<?>> javaTypeClass = normalizeJavaType( javaType.value() );
if ( javaTypeClass != null ) {
if ( buildingContext.getBuildingOptions().disallowExtensionsInCdi() ) {
if ( !buildingContext.getBuildingOptions().isAllowExtensionsInCdi() ) {
return FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( javaTypeClass );
}
return getManagedBeanRegistry().getBean( javaTypeClass ).getBeanInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ private static ManagedBean<? extends UserCollectionType> createCustomType(
Map<String,String> parameters,
MetadataBuildingContext buildingContext) {
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
return MappingHelper.createLocalUserCollectionTypeBean( role, implementation, hasParameters, parameters );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ static Component fillEmbeddable(
private static CompositeUserType<?> compositeUserType(
Class<? extends CompositeUserType<?>> compositeUserTypeClass,
MetadataBuildingContext context) {
if ( context.getBuildingOptions().disallowExtensionsInCdi() ) {
if ( !context.getBuildingOptions().isAllowExtensionsInCdi() ) {
FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( compositeUserTypeClass );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2410,7 +2410,7 @@ private BasicType<?> resolveExplicitlyNamedAnyDiscriminatorType(
}

private Object typeInstance(String typeName, Class<?> typeJavaType) {
if ( metadataBuildingContext.getBuildingOptions().disallowExtensionsInCdi() ) {
if ( !metadataBuildingContext.getBuildingOptions().isAllowExtensionsInCdi() ) {
return FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( typeJavaType );
}
else {
Expand Down Expand Up @@ -2621,7 +2621,7 @@ else if ( isVirtual ) {
if ( CompositeUserType.class.isAssignableFrom( componentClass ) ) {
componentBinding.setTypeName( explicitComponentClassName );
CompositeUserType<?> compositeUserType;
if ( sourceDocument.getBuildingOptions().disallowExtensionsInCdi() ) {
if ( !sourceDocument.getBuildingOptions().isAllowExtensionsInCdi() ) {
compositeUserType = (CompositeUserType<?>) FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( componentClass );
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public boolean isXmlMappingEnabled() {
}

@Override
public boolean disallowExtensionsInCdi() {
return delegate.disallowExtensionsInCdi();
public boolean isAllowExtensionsInCdi() {
return delegate.isAllowExtensionsInCdi();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -243,5 +243,15 @@ default boolean isXmlMappingEnabled() {
/**
* 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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ private Properties getCustomTypeProperties() {

private UserType<?> getConfiguredUserTypeBean(Class<? extends UserType<?>> explicitCustomType, Properties properties) {
final UserType<?> typeInstance =
getBuildingContext().getBuildingOptions().disallowExtensionsInCdi()
!getBuildingContext().getBuildingOptions().isAllowExtensionsInCdi()
? FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( explicitCustomType )
: getUserTypeBean( explicitCustomType, properties ).getBeanInstance();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ private CompositeUserType<?> createCompositeUserType(Component component) {
final BootstrapContext bootstrapContext = getBuildingContext().getBootstrapContext();
final Class<CompositeUserType<?>> customTypeClass =
bootstrapContext.getClassLoaderAccess().classForName( component.getTypeName() );
return getBuildingContext().getBuildingOptions().disallowExtensionsInCdi()
return !getBuildingContext().getBuildingOptions().isAllowExtensionsInCdi()
? FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( customTypeClass )
: bootstrapContext.getServiceRegistry().requireService( ManagedBeanRegistry.class )
.getBean( customTypeClass ).getBeanInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static CollectionType customCollection(
final boolean hasParameters = CollectionHelper.isNotEmpty( typeParameters );
final ManagedBean<? extends UserCollectionType> userTypeBean;

if ( metadata.getMetadataBuildingOptions().disallowExtensionsInCdi() ) {
if ( !metadata.getMetadataBuildingOptions().isAllowExtensionsInCdi() ) {
//noinspection unchecked,rawtypes
userTypeBean = createLocalUserCollectionTypeBean(
role,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public EmbeddableRepresentationStrategy resolveStrategy(
final Class<CompositeUserType<?>> userTypeClass = creationContext.getBootstrapContext()
.getClassLoaderAccess()
.classForName( bootDescriptor.getTypeName() );
if ( creationContext.getBootModel().getMetadataBuildingOptions().disallowExtensionsInCdi() ) {
if ( !creationContext.getBootModel().getMetadataBuildingOptions().isAllowExtensionsInCdi() ) {
compositeUserType = FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( userTypeClass );
}
else {
Expand All @@ -99,7 +99,7 @@ public EmbeddableRepresentationStrategy resolveStrategy(
final EmbeddableInstantiator customInstantiator;
if ( bootDescriptor.getCustomInstantiator() != null ) {
final Class<? extends EmbeddableInstantiator> instantiatorClass = bootDescriptor.getCustomInstantiator();
if ( creationContext.getBootModel().getMetadataBuildingOptions().disallowExtensionsInCdi() ) {
if ( !creationContext.getBootModel().getMetadataBuildingOptions().isAllowExtensionsInCdi() ) {
customInstantiator = FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( instantiatorClass );
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ else if ( sessionFactory != null ) {
private void setMetadataBuildingContext(MetadataBuildingContext metadataBuildingContext) {
this.metadataBuildingContext = metadataBuildingContext;
if ( metadataBuildingContext != null ) {
this.allowExtensionsInCdi = metadataBuildingContext.getBuildingOptions().disallowExtensionsInCdi();
this.allowExtensionsInCdi = metadataBuildingContext.getBuildingOptions().isAllowExtensionsInCdi();
}
}

Expand Down Expand Up @@ -814,7 +814,7 @@ public static boolean isDuration(SqmExpressible<?> type) {

@Internal @SuppressWarnings("unchecked")
public <J> MutabilityPlan<J> createMutabilityPlan(Class<? extends MutabilityPlan<?>> planClass) {
if ( scope.allowExtensionsInCdi ) {
if ( !scope.allowExtensionsInCdi ) {
//noinspection rawtypes
return (MutabilityPlan) FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( planClass );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void addComponent(
final Component propComponent = (Component) value;
final EmbeddableInstantiator instantiator;
if ( propComponent.getCustomInstantiator() != null ) {
if ( getMetadataBuildingContext().getBuildingOptions().disallowExtensionsInCdi() ) {
if ( !getMetadataBuildingContext().getBuildingOptions().isAllowExtensionsInCdi() ) {
instantiator = FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( propComponent.getCustomInstantiator() );
}
else {
Expand All @@ -68,7 +68,7 @@ else if ( propComponent.getTypeName() != null ) {
final Class<CompositeUserType<?>> userTypeClass = getMetadataBuildingContext().getBootstrapContext()
.getClassLoaderAccess()
.classForName( propComponent.getTypeName() );
if ( getMetadataBuildingContext().getBuildingOptions().disallowExtensionsInCdi() ) {
if ( !getMetadataBuildingContext().getBuildingOptions().isAllowExtensionsInCdi() ) {
final CompositeUserType<?> compositeUserType = FallbackBeanInstanceProducer.INSTANCE.produceBeanInstance( userTypeClass );
//noinspection rawtypes
instantiator = new EmbeddableCompositeUserTypeInstantiator( (CompositeUserType) compositeUserType );
Expand Down

0 comments on commit f309a88

Please sign in to comment.