172172import static org .hibernate .engine .spi .ExecuteUpdateResultCheckStyle .fromResultCheckStyle ;
173173import static org .hibernate .internal .util .ReflectHelper .getDefaultSupplier ;
174174import static org .hibernate .internal .util .StringHelper .getNonEmptyOrConjunctionIfBothNonEmpty ;
175- import static org .hibernate .internal .util .StringHelper .isEmpty ;
176- import static org .hibernate .internal .util .StringHelper .isNotEmpty ;
175+ import static org .hibernate .internal .util .StringHelper .isBlank ;
176+ import static org .hibernate .internal .util .StringHelper .isNotBlank ;
177177import static org .hibernate .internal .util .StringHelper .nullIfEmpty ;
178178import static org .hibernate .internal .util .StringHelper .qualify ;
179179import static org .hibernate .internal .util .collections .CollectionHelper .isEmpty ;
180+ import static org .hibernate .internal .util .collections .CollectionHelper .isNotEmpty ;
180181import static org .hibernate .mapping .MappingHelper .createLocalUserCollectionTypeBean ;
181182
182183/**
@@ -459,7 +460,7 @@ && isToManyAssociationWithinEmbeddableCollection( propertyHolder ) ) {
459460
460461 if ( property .hasDirectAnnotationUsage ( OrderColumn .class )
461462 && manyToMany != null
462- && StringHelper . isNotEmpty ( manyToMany .mappedBy () ) ) {
463+ && isNotBlank ( manyToMany .mappedBy () ) ) {
463464 throw new AnnotationException ("Collection '" + getPath ( propertyHolder , inferredData ) +
464465 "' is the unowned side of a bidirectional '@ManyToMany' and may not have an '@OrderColumn'" );
465466 }
@@ -740,7 +741,7 @@ private static void bindJoinedTableAssociation(
740741 }
741742
742743 collectionBinder .setExplicitAssociationTable ( true );
743- if ( CollectionHelper . isNotEmpty ( jpaIndexes ) ) {
744+ if ( isNotEmpty ( jpaIndexes ) ) {
744745 associationTableBinder .setJpaIndex ( jpaIndexes );
745746 }
746747 if ( !schema .isEmpty () ) {
@@ -910,7 +911,7 @@ private static ManagedBean<? extends UserCollectionType> createCustomType(
910911 Class <? extends UserCollectionType > implementation ,
911912 Map <String ,String > parameters ,
912913 MetadataBuildingContext buildingContext ) {
913- final boolean hasParameters = CollectionHelper . isNotEmpty ( parameters );
914+ final boolean hasParameters = isNotEmpty ( parameters );
914915 if ( !buildingContext .getBuildingOptions ().isAllowExtensionsInCdi () ) {
915916 // if deferred container access is enabled, we locally create the user-type
916917 return createLocalUserCollectionTypeBean ( role , implementation , hasParameters , parameters );
@@ -1094,13 +1095,13 @@ private static CollectionClassification determineCollectionClassification(
10941095
10951096 final SourceModelBuildingContext sourceModelContext = buildingContext .getMetadataCollector ().getSourceModelBuildingContext ();
10961097 final ManyToMany manyToMany = property .getAnnotationUsage ( ManyToMany .class , sourceModelContext );
1097- if ( manyToMany != null && !manyToMany .mappedBy ().isEmpty () ) {
1098+ if ( manyToMany != null && !manyToMany .mappedBy ().isBlank () ) {
10981099 // We don't support @OrderColumn on the non-owning side of a many-to-many association.
10991100 return CollectionClassification .BAG ;
11001101 }
11011102
11021103 final OneToMany oneToMany = property .getAnnotationUsage ( OneToMany .class , sourceModelContext );
1103- if ( oneToMany != null && !oneToMany .mappedBy ().isEmpty () ) {
1104+ if ( oneToMany != null && !oneToMany .mappedBy ().isBlank () ) {
11041105 // Unowned to-many mappings are always considered BAG by default
11051106 return CollectionClassification .BAG ;
11061107 }
@@ -1268,7 +1269,7 @@ private void bindOptimisticLock(boolean isMappedBy) {
12681269
12691270 private void bindCache () {
12701271 //set cache
1271- if ( isNotEmpty ( cacheConcurrencyStrategy ) ) {
1272+ if ( isNotBlank ( cacheConcurrencyStrategy ) ) {
12721273 collection .setCacheConcurrencyStrategy ( cacheConcurrencyStrategy );
12731274 collection .setCacheRegionName ( cacheRegionName );
12741275 }
@@ -1780,7 +1781,7 @@ private void handleJpaOrderBy(Collection collection, PersistentClass associatedC
17801781 final String hqlOrderBy = extractHqlOrderBy ( jpaOrderBy );
17811782 if ( hqlOrderBy != null ) {
17821783 final String orderByFragment = buildOrderByClauseFromHql ( hqlOrderBy , associatedClass );
1783- if ( isNotEmpty ( orderByFragment ) ) {
1784+ if ( isNotBlank ( orderByFragment ) ) {
17841785 collection .setOrderBy ( orderByFragment );
17851786 }
17861787 }
@@ -1824,7 +1825,7 @@ private void addFilter(boolean hasAssociationTable, Filter filterAnnotation) {
18241825 final String alias = aliasAnnotation .alias ();
18251826
18261827 final String table = aliasAnnotation .table ();
1827- if ( isNotEmpty ( table ) ) {
1828+ if ( isNotBlank ( table ) ) {
18281829 aliasTableMap .put ( alias , table );
18291830 }
18301831
@@ -1870,7 +1871,7 @@ private void handleWhere(boolean hasAssociationTable) {
18701871 }
18711872
18721873 final String whereJoinTableClause = getWhereJoinTableClause ();
1873- if ( isNotEmpty ( whereJoinTableClause ) ) {
1874+ if ( isNotBlank ( whereJoinTableClause ) ) {
18741875 if ( hasAssociationTable ) {
18751876 // This is a many-to-many association.
18761877 // Collection#setWhere is used to set the "where" clause that applies to the collection table
@@ -1926,7 +1927,7 @@ private void addFilterJoinTable(boolean hasAssociationTable, FilterJoinTable fil
19261927 final String alias = aliasAnnotation .alias ();
19271928
19281929 final String table = aliasAnnotation .table ();
1929- if ( isNotEmpty ( table ) ) {
1930+ if ( isNotBlank ( table ) ) {
19301931 aliasTableMap .put ( alias , table );
19311932 }
19321933
@@ -1952,14 +1953,14 @@ private void addFilterJoinTable(boolean hasAssociationTable, FilterJoinTable fil
19521953
19531954 private String getFilterConditionForJoinTable (FilterJoinTable filterJoinTableAnnotation ) {
19541955 final String condition = filterJoinTableAnnotation .condition ();
1955- return condition .isEmpty ()
1956+ return condition .isBlank ()
19561957 ? getDefaultFilterCondition ( filterJoinTableAnnotation .name (), filterJoinTableAnnotation )
19571958 : condition ;
19581959 }
19591960
19601961 private String getFilterCondition (Filter filter ) {
19611962 final String condition = filter .condition ();
1962- return condition .isEmpty ()
1963+ return condition .isBlank ()
19631964 ? getDefaultFilterCondition ( filter .name (), filter )
19641965 : condition ;
19651966 }
@@ -1972,7 +1973,7 @@ private String getDefaultFilterCondition(String name, Annotation annotation) {
19721973 + "' for an undefined filter named '" + name + "'" );
19731974 }
19741975 final String defaultCondition = definition .getDefaultFilterCondition ();
1975- if ( isEmpty ( defaultCondition ) ) {
1976+ if ( isBlank ( defaultCondition ) ) {
19761977 throw new AnnotationException ( "Collection '" + qualify ( propertyHolder .getPath (), propertyName ) +
19771978 "' has a '@" + annotation .annotationType ().getSimpleName ()
19781979 + "' with no 'condition' and no default condition was given by the '@FilterDef' named '"
@@ -2016,7 +2017,7 @@ private static String buildOrderByClauseFromHql(String orderByFragment, Persiste
20162017 if ( orderByFragment == null ) {
20172018 return null ;
20182019 }
2019- else if ( orderByFragment .isEmpty () ) {
2020+ else if ( orderByFragment .isBlank () ) {
20202021 //order by id
20212022 return buildOrderById ( associatedClass , " asc" );
20222023 }
@@ -2042,7 +2043,7 @@ private static String buildOrderById(PersistentClass associatedClass, String ord
20422043 public static String adjustUserSuppliedValueCollectionOrderingFragment (String orderByFragment ) {
20432044 if ( orderByFragment != null ) {
20442045 orderByFragment = orderByFragment .trim ();
2045- if ( orderByFragment .isEmpty () || orderByFragment .equalsIgnoreCase ( "asc" ) ) {
2046+ if ( orderByFragment .isBlank () || orderByFragment .equalsIgnoreCase ( "asc" ) ) {
20462047 // This indicates something like either:
20472048 // `@OrderBy()`
20482049 // `@OrderBy("asc")
@@ -2124,7 +2125,7 @@ private DependantValue buildCollectionKey(AnnotatedJoinColumns joinColumns, OnDe
21242125 if ( !ArrayHelper .isEmpty ( joinColumnAnnotations ) ) {
21252126 final JoinColumn joinColumnAnn = joinColumnAnnotations [0 ];
21262127 final ForeignKey joinColumnForeignKey = joinColumnAnn .foreignKey ();
2127- if ( foreignKeyName .isEmpty () ) {
2128+ if ( foreignKeyName .isBlank () ) {
21282129 foreignKeyName = joinColumnForeignKey .name ();
21292130 foreignKeyDefinition = joinColumnForeignKey .foreignKeyDefinition ();
21302131 foreignKeyOptions = joinColumnForeignKey .options ();
@@ -2153,7 +2154,7 @@ private DependantValue buildCollectionKey(AnnotatedJoinColumns joinColumns, OnDe
21532154 final OneToMany oneToManyAnn = property .getDirectAnnotationUsage ( OneToMany .class );
21542155 final OnDelete onDeleteAnn = property .getDirectAnnotationUsage ( OnDelete .class );
21552156 if ( oneToManyAnn != null
2156- && !oneToManyAnn .mappedBy ().isEmpty ()
2157+ && !oneToManyAnn .mappedBy ().isBlank ()
21572158 && ( onDeleteAnn == null || onDeleteAnn .action () != OnDeleteAction .CASCADE ) ) {
21582159 // foreign key should be up to @ManyToOne side
21592160 // @OnDelete generate "on delete cascade" foreign key
@@ -2342,7 +2343,7 @@ private void handleCompositeCollectionElement(
23422343 inheritanceStatePerClass
23432344 );
23442345 collection .setElement ( component );
2345- if ( isNotEmpty ( hqlOrderBy ) ) {
2346+ if ( isNotBlank ( hqlOrderBy ) ) {
23462347 final String orderBy = adjustUserSuppliedValueCollectionOrderingFragment ( hqlOrderBy );
23472348 if ( orderBy != null ) {
23482349 collection .setOrderBy ( orderBy );
@@ -2544,7 +2545,7 @@ private void handleOwnedManyToMany(PersistentClass collectionEntity, boolean isC
25442545 collector .getLogicalTableName ( owner .getTable () ),
25452546 collector .getFromMappedBy ( owner .getEntityName (), joinColumns .getPropertyName () )
25462547 );
2547- if ( isEmpty ( tableBinder .getName () ) ) {
2548+ if ( isBlank ( tableBinder .getName () ) ) {
25482549 //default value
25492550 tableBinder .setDefaultName (
25502551 owner .getClassName (),
@@ -2581,7 +2582,7 @@ private void handleCheckConstraints(Table collectionTable) {
25812582 private static void addCheckToCollection (Table collectionTable , Check check ) {
25822583 final String name = check .name ();
25832584 final String constraint = check .constraints ();
2584- collectionTable .addCheck ( name .isEmpty ()
2585+ collectionTable .addCheck ( name .isBlank ()
25852586 ? new CheckConstraint ( constraint )
25862587 : new CheckConstraint ( name , constraint ) );
25872588 }
@@ -2742,7 +2743,7 @@ private static String extractHqlOrderBy(OrderBy jpaOrderBy) {
27422743
27432744 private static void checkFilterConditions (Collection collection ) {
27442745 //for now it can't happen, but sometime soon...
2745- if ( ( !collection .getFilters ().isEmpty () || isNotEmpty ( collection .getWhere () ) )
2746+ if ( ( !collection .getFilters ().isEmpty () || isNotBlank ( collection .getWhere () ) )
27462747 && collection .getFetchMode () == FetchMode .JOIN
27472748 && !( collection .getElement () instanceof SimpleValue ) //SimpleValue (CollectionOfElements) are always SELECT but it does not matter
27482749 && collection .getElement ().getFetchMode () != FetchMode .JOIN ) {
0 commit comments