175175import static org .hibernate .boot .models .JpaAnnotations .UNIQUE_CONSTRAINT ;
176176import static org .hibernate .boot .models .xml .internal .UserTypeCasesMapKey .MAP_KEY_USER_TYPE_CASES ;
177177import static org .hibernate .boot .models .xml .internal .UserTypeCasesStandard .STANDARD_USER_TYPE_CASES ;
178+ import static org .hibernate .internal .util .StringHelper .isEmpty ;
179+ import static org .hibernate .internal .util .StringHelper .isNotEmpty ;
180+ import static org .hibernate .internal .util .StringHelper .unqualify ;
178181
179182/**
180183 * Helper for creating annotation from equivalent JAXB
@@ -194,7 +197,7 @@ public static void applyEntity(
194197 JpaAnnotations .ENTITY ,
195198 xmlDocumentContext .getModelBuildingContext ()
196199 );
197- if ( StringHelper . isNotEmpty ( jaxbEntity .getName () ) ) {
200+ if ( isNotEmpty ( jaxbEntity .getName () ) ) {
198201 entityAnn .name ( jaxbEntity .getName () );
199202 }
200203 }
@@ -227,8 +230,8 @@ public static void applyColumnTransformation(
227230 JaxbColumnImpl jaxbColumn ,
228231 MutableMemberDetails memberDetails ,
229232 XmlDocumentContext xmlDocumentContext ) {
230- if ( StringHelper . isEmpty ( jaxbColumn .getRead () )
231- && StringHelper . isEmpty ( jaxbColumn .getWrite () ) ) {
233+ if ( isEmpty ( jaxbColumn .getRead () )
234+ && isEmpty ( jaxbColumn .getWrite () ) ) {
232235 return ;
233236 }
234237
@@ -239,10 +242,10 @@ public static void applyColumnTransformation(
239242
240243 annotationUsage .forColumn ( jaxbColumn .getName () );
241244
242- if ( StringHelper . isNotEmpty ( jaxbColumn .getRead () ) ) {
245+ if ( isNotEmpty ( jaxbColumn .getRead () ) ) {
243246 annotationUsage .read ( jaxbColumn .getRead () );
244247 }
245- if ( StringHelper . isNotEmpty ( jaxbColumn .getWrite () ) ) {
248+ if ( isNotEmpty ( jaxbColumn .getWrite () ) ) {
246249 annotationUsage .write ( jaxbColumn .getWrite () );
247250 }
248251 }
@@ -266,7 +269,7 @@ public static void applyUserType(
266269 MutableMemberDetails memberDetails ,
267270 UserTypeCases cases ,
268271 XmlDocumentContext xmlDocumentContext ) {
269- if ( jaxbType == null || StringHelper . isEmpty ( jaxbType .getValue () ) ) {
272+ if ( jaxbType == null || isEmpty ( jaxbType .getValue () ) ) {
270273 cases .handleNone ( jaxbType , memberDetails , xmlDocumentContext );
271274 return ;
272275 }
@@ -383,7 +386,7 @@ public static void applyCollectionId(
383386 }
384387
385388 final JaxbGeneratedValueImpl generator = jaxbCollectionId .getGenerator ();
386- if ( generator != null && StringHelper . isNotEmpty ( generator .getGenerator () ) ) {
389+ if ( generator != null && isNotEmpty ( generator .getGenerator () ) ) {
387390 collectionIdAnn .generator ( generator .getGenerator () );
388391 }
389392 }
@@ -510,7 +513,7 @@ public static void applyGeneratedValue(
510513 generatedValueAnn .strategy ( jaxbGeneratedValue .getStrategy () );
511514 }
512515
513- if ( StringHelper . isNotEmpty ( jaxbGeneratedValue .getGenerator () ) ) {
516+ if ( isNotEmpty ( jaxbGeneratedValue .getGenerator () ) ) {
514517 generatedValueAnn .generator ( jaxbGeneratedValue .getGenerator () );
515518 }
516519 }
@@ -528,19 +531,19 @@ public static void applySequenceGenerator(
528531 xmlDocumentContext .getModelBuildingContext ()
529532 );
530533
531- if ( StringHelper . isNotEmpty ( jaxbGenerator .getName () ) ) {
534+ if ( isNotEmpty ( jaxbGenerator .getName () ) ) {
532535 sequenceAnn .name ( jaxbGenerator .getName () );
533536 }
534537
535538 if ( jaxbGenerator .getSequenceName () != null ) {
536539 sequenceAnn .sequenceName ( jaxbGenerator .getSequenceName () );
537540 }
538541
539- if ( StringHelper . isNotEmpty ( jaxbGenerator .getCatalog () ) ) {
542+ if ( isNotEmpty ( jaxbGenerator .getCatalog () ) ) {
540543 sequenceAnn .catalog ( jaxbGenerator .getCatalog () );
541544 }
542545
543- if ( StringHelper . isNotEmpty ( jaxbGenerator .getSchema () ) ) {
546+ if ( isNotEmpty ( jaxbGenerator .getSchema () ) ) {
544547 sequenceAnn .schema ( jaxbGenerator .getSchema () );
545548 }
546549
@@ -552,7 +555,7 @@ public static void applySequenceGenerator(
552555 sequenceAnn .allocationSize ( jaxbGenerator .getAllocationSize () );
553556 }
554557
555- if ( StringHelper . isNotEmpty ( jaxbGenerator .getOptions () ) ) {
558+ if ( isNotEmpty ( jaxbGenerator .getOptions () ) ) {
556559 sequenceAnn .options ( jaxbGenerator .getOptions () );
557560 }
558561 }
@@ -839,10 +842,10 @@ private static void transferConvertDetails(
839842 ConvertJpaAnnotation convert ,
840843 String namePrefix ,
841844 XmlDocumentContext xmlDocumentContext ) {
842- if ( StringHelper . isNotEmpty ( jaxbConvert .getConverter () ) ) {
845+ if ( isNotEmpty ( jaxbConvert .getConverter () ) ) {
843846 convert .converter ( xmlDocumentContext .resolveJavaType ( jaxbConvert .getConverter () ).toJavaClass () );
844847 }
845- if ( StringHelper . isNotEmpty ( jaxbConvert .getAttributeName () ) ) {
848+ if ( isNotEmpty ( jaxbConvert .getAttributeName () ) ) {
846849 convert .attributeName ( prefixIfNotAlready ( jaxbConvert .getAttributeName (), namePrefix ) );
847850 }
848851 if ( jaxbConvert .isDisableConversion () != null ) {
@@ -858,16 +861,16 @@ public static void applyTable(
858861 final XmlDocument .Defaults defaults = xmlDocumentContext .getXmlDocument ().getDefaults ();
859862 final String catalog = defaults .getCatalog ();
860863 final String schema = defaults .getSchema ();
861- if ( StringHelper . isNotEmpty ( catalog ) || StringHelper . isNotEmpty ( schema ) ) {
864+ if ( isNotEmpty ( catalog ) || isNotEmpty ( schema ) ) {
862865 final TableJpaAnnotation tableAnn = (TableJpaAnnotation ) target .applyAnnotationUsage (
863866 JpaAnnotations .TABLE ,
864867 xmlDocumentContext .getModelBuildingContext ()
865868 );
866- if ( StringHelper . isNotEmpty ( catalog ) ) {
869+ if ( isNotEmpty ( catalog ) ) {
867870 tableAnn .catalog ( catalog );
868871
869872 }
870- if ( StringHelper . isNotEmpty ( schema ) ) {
873+ if ( isNotEmpty ( schema ) ) {
871874 tableAnn .schema ( schema );
872875 }
873876 }
@@ -882,7 +885,7 @@ public static void applyTable(
882885 }
883886
884887 public static void applyOptionalString (String value , Consumer <String > target ) {
885- if ( StringHelper . isNotEmpty ( value ) ) {
888+ if ( isNotEmpty ( value ) ) {
886889 target .accept ( value );
887890 }
888891 }
@@ -901,7 +904,7 @@ public static void applyNaturalIdCache(
901904 );
902905
903906 final JaxbCachingImpl jaxbCaching = jaxbNaturalId .getCaching ();
904- if ( StringHelper . isNotEmpty ( jaxbCaching .getRegion () ) ) {
907+ if ( isNotEmpty ( jaxbCaching .getRegion () ) ) {
905908 naturalIdCacheUsage .region ( jaxbCaching .getRegion () );
906909 }
907910 }
@@ -948,7 +951,7 @@ public static ClassDetails resolveJavaType(String value, ClassDetailsRegistry cl
948951 }
949952
950953 public static ClassDetails resolveJavaType (String packageName , String name , ClassDetailsRegistry classDetailsRegistry ) {
951- if ( StringHelper . isEmpty ( name ) ) {
954+ if ( isEmpty ( name ) ) {
952955 name = Object .class .getName ();
953956 }
954957 else if ( byte .class .getName ().equals ( name )
@@ -1013,17 +1016,17 @@ public static void applyBasicTypeComposition(
10131016 else if ( jaxbBasicMapping .getJavaType () != null ) {
10141017 applyJavaTypeDescriptor ( jaxbBasicMapping .getJavaType (), memberDetails , xmlDocumentContext );
10151018 }
1016- else if ( StringHelper . isNotEmpty ( jaxbBasicMapping .getTarget () ) ) {
1019+ else if ( isNotEmpty ( jaxbBasicMapping .getTarget () ) ) {
10171020 applyTargetClass ( jaxbBasicMapping .getTarget (), memberDetails , xmlDocumentContext );
10181021 }
10191022
1020- if ( StringHelper . isNotEmpty ( jaxbBasicMapping .getJdbcType () ) ) {
1023+ if ( isNotEmpty ( jaxbBasicMapping .getJdbcType () ) ) {
10211024 applyJdbcTypeDescriptor ( jaxbBasicMapping .getJdbcType (), memberDetails , xmlDocumentContext );
10221025 }
10231026 else if ( jaxbBasicMapping .getJdbcTypeCode () != null ) {
10241027 applyJdbcTypeCode ( jaxbBasicMapping .getJdbcTypeCode (), memberDetails , xmlDocumentContext );
10251028 }
1026- else if ( StringHelper . isNotEmpty ( jaxbBasicMapping .getJdbcTypeName () ) ) {
1029+ else if ( isNotEmpty ( jaxbBasicMapping .getJdbcTypeName () ) ) {
10271030 applyJdbcTypeCode (
10281031 resolveJdbcTypeName ( jaxbBasicMapping .getJdbcTypeName () ),
10291032 memberDetails ,
@@ -1143,7 +1146,7 @@ public static void applySqlRestriction(
11431146 String sqlRestriction ,
11441147 MutableAnnotationTarget target ,
11451148 XmlDocumentContext xmlDocumentContext ) {
1146- if ( StringHelper . isEmpty ( sqlRestriction ) ) {
1149+ if ( isEmpty ( sqlRestriction ) ) {
11471150 return ;
11481151 }
11491152
@@ -1158,7 +1161,7 @@ public static void applySqlJoinTableRestriction(
11581161 String sqlRestriction ,
11591162 MutableAnnotationTarget target ,
11601163 XmlDocumentContext xmlDocumentContext ) {
1161- if ( StringHelper . isEmpty ( sqlRestriction ) ) {
1164+ if ( isEmpty ( sqlRestriction ) ) {
11621165 return ;
11631166 }
11641167 final SQLJoinTableRestrictionAnnotation sqlRestrictionAnn = (SQLJoinTableRestrictionAnnotation ) target .applyAnnotationUsage (
@@ -1195,7 +1198,7 @@ public static void applyCustomSql(
11951198 annotation .sql ( jaxbCustomSql .getValue () );
11961199 annotation .callable ( jaxbCustomSql .isCallable () );
11971200
1198- if ( StringHelper . isNotEmpty ( jaxbCustomSql .getTable () ) ) {
1201+ if ( isNotEmpty ( jaxbCustomSql .getTable () ) ) {
11991202 annotation .table ( jaxbCustomSql .getTable () );
12001203 }
12011204
@@ -1217,7 +1220,7 @@ static void applyIdClass(
12171220 JaxbIdClassImpl jaxbIdClass ,
12181221 MutableClassDetails target ,
12191222 XmlDocumentContext xmlDocumentContext ) {
1220- if ( jaxbIdClass == null || StringHelper . isEmpty ( jaxbIdClass .getClazz () ) ) {
1223+ if ( jaxbIdClass == null || isEmpty ( jaxbIdClass .getClazz () ) ) {
12211224 return ;
12221225 }
12231226
@@ -1325,7 +1328,8 @@ private static MutableMemberDetails getCallbackMethodDetails(
13251328 JpaEventListenerStyle callbackType ,
13261329 ClassDetails classDetails ) {
13271330 for ( MethodDetails method : classDetails .getMethods () ) {
1328- if ( method .getName ().equals ( name ) && JpaEventListener .matchesSignature ( callbackType , method ) ) {
1331+ if ( method .getName ().equals ( name )
1332+ && JpaEventListener .matchesSignature ( callbackType , method ) ) {
13291333 return (MutableMemberDetails ) method ;
13301334 }
13311335 }
@@ -1344,14 +1348,14 @@ static void applyRowId(
13441348 HibernateAnnotations .ROW_ID ,
13451349 xmlDocumentContext .getModelBuildingContext ()
13461350 );
1347- if ( StringHelper . isNotEmpty ( rowId ) ) {
1351+ if ( isNotEmpty ( rowId ) ) {
13481352 rowIdAnn .value ( rowId );
13491353 }
13501354 }
13511355
13521356 private static String prefixIfNotAlready (String value , String prefix ) {
1353- if ( StringHelper . isNotEmpty ( prefix ) ) {
1354- final String previous = StringHelper . unqualify ( value );
1357+ if ( isNotEmpty ( prefix ) ) {
1358+ final String previous = unqualify ( value );
13551359 if ( !previous .equalsIgnoreCase ( prefix ) ) {
13561360 return StringHelper .qualify ( prefix , value );
13571361 }
@@ -1363,7 +1367,7 @@ static void applyDiscriminatorValue(
13631367 String discriminatorValue ,
13641368 MutableClassDetails target ,
13651369 XmlDocumentContext xmlDocumentContext ) {
1366- if ( StringHelper . isEmpty ( discriminatorValue ) ) {
1370+ if ( isEmpty ( discriminatorValue ) ) {
13671371 return ;
13681372 }
13691373
@@ -1408,7 +1412,7 @@ public static void applyDiscriminatorFormula(
14081412 if ( jaxbDiscriminatorFormula == null ) {
14091413 return ;
14101414 }
1411- if ( StringHelper . isEmpty ( jaxbDiscriminatorFormula .getFragment () ) ) {
1415+ if ( isEmpty ( jaxbDiscriminatorFormula .getFragment () ) ) {
14121416 return ;
14131417 }
14141418
@@ -1464,10 +1468,10 @@ public static void applySchema(
14641468 return ;
14651469 }
14661470
1467- if ( StringHelper . isNotEmpty ( jaxbNode .getSchema () ) ) {
1471+ if ( isNotEmpty ( jaxbNode .getSchema () ) ) {
14681472 annotationUsage .schema ( jaxbNode .getSchema () );
14691473 }
1470- else if ( StringHelper . isNotEmpty ( documentSchema ( xmlDocumentContext ) ) ) {
1474+ else if ( isNotEmpty ( documentSchema ( xmlDocumentContext ) ) ) {
14711475 annotationUsage .schema ( documentSchema ( xmlDocumentContext ) );
14721476 }
14731477 }
@@ -1500,10 +1504,10 @@ public static void applyCatalog(
15001504 return ;
15011505 }
15021506
1503- if ( StringHelper . isNotEmpty ( jaxbNode .getCatalog () ) ) {
1507+ if ( isNotEmpty ( jaxbNode .getCatalog () ) ) {
15041508 annotationUsage .catalog ( jaxbNode .getCatalog () );
15051509 }
1506- else if ( StringHelper . isNotEmpty ( documentCatalog ( xmlDocumentContext ) ) ) {
1510+ else if ( isNotEmpty ( documentCatalog ( xmlDocumentContext ) ) ) {
15071511 annotationUsage .catalog ( documentCatalog ( xmlDocumentContext ) );
15081512 }
15091513 }
0 commit comments