1212
1313import org .hibernate .boot .MappingException ;
1414import org .hibernate .boot .jaxb .hbm .spi .JaxbHbmColumnType ;
15- import org .hibernate .boot .model .TruthValue ;
1615import org .hibernate .boot .model .source .spi .ColumnSource ;
1716import org .hibernate .boot .model .source .spi .DerivedValueSource ;
1817import org .hibernate .boot .model .source .spi .RelationalValueSource ;
1918import org .hibernate .boot .model .source .spi .SizeSource ;
20- import org .hibernate .internal .util .StringHelper ;
2119import org .hibernate .internal .util .collections .CollectionHelper ;
2220
21+ import static org .hibernate .internal .util .StringHelper .isNotEmpty ;
22+
2323/**
2424 * @author Steve Ebersole
2525 */
@@ -152,7 +152,7 @@ public static RelationalValueSource buildValueSource(
152152 if ( sources .size () > 1 ) {
153153 final String errorMessage ;
154154 if ( columnsAndFormulasSource .getSourceType ().canBeNamed ()
155- && StringHelper . isNotEmpty ( columnsAndFormulasSource .getSourceName () ) ) {
155+ && isNotEmpty ( columnsAndFormulasSource .getSourceName () ) ) {
156156 errorMessage = String .format (
157157 Locale .ENGLISH ,
158158 "Expecting just a single formula/column in context of <%s name=\" %s\" />" ,
@@ -197,7 +197,7 @@ public static ColumnSource buildColumnSource(
197197 if ( sources .size () > 1 ) {
198198 final String errorMessage ;
199199 if ( columnsAndFormulasSource .getSourceType ().canBeNamed ()
200- && StringHelper . isNotEmpty ( columnsAndFormulasSource .getSourceName () ) ) {
200+ && isNotEmpty ( columnsAndFormulasSource .getSourceName () ) ) {
201201 errorMessage = String .format (
202202 Locale .ENGLISH ,
203203 "Expecting just a single formula/column in context of <%s name=\" %s\" />" ,
@@ -219,7 +219,7 @@ public static ColumnSource buildColumnSource(
219219 if ( !(result instanceof ColumnSource ) ) {
220220 final String errorMessage ;
221221 if ( columnsAndFormulasSource .getSourceType ().canBeNamed ()
222- && StringHelper . isNotEmpty ( columnsAndFormulasSource .getSourceName () ) ) {
222+ && isNotEmpty ( columnsAndFormulasSource .getSourceName () ) ) {
223223 errorMessage = String .format (
224224 Locale .ENGLISH ,
225225 "Expecting single column in context of <%s name=\" %s\" />, but found formula [%s]" ,
@@ -267,7 +267,7 @@ public static List<ColumnSource> buildColumnSources(
267267 if ( !(source instanceof ColumnSource ) ) {
268268 final String errorMessage ;
269269 if ( columnsAndFormulasSource .getSourceType ().canBeNamed ()
270- && StringHelper . isNotEmpty ( columnsAndFormulasSource .getSourceName () ) ) {
270+ && isNotEmpty ( columnsAndFormulasSource .getSourceName () ) ) {
271271 errorMessage = String .format (
272272 Locale .ENGLISH ,
273273 "Expecting only columns in context of <%s name=\" %s\" />, but found formula [%s]" ,
@@ -307,7 +307,7 @@ public static List<RelationalValueSource> buildValueSources(
307307 ColumnsAndFormulasSource columnsAndFormulasSource ) {
308308 List <RelationalValueSource > result = new ArrayList <>();
309309
310- if ( StringHelper . isNotEmpty ( columnsAndFormulasSource .getFormulaAttribute () ) ) {
310+ if ( isNotEmpty ( columnsAndFormulasSource .getFormulaAttribute () ) ) {
311311 // we have an explicit formula attribute (i.e., <SOMETHING formula="abc"/>)
312312 validateUseOfFormulaAttribute ( mappingDocument , columnsAndFormulasSource );
313313
@@ -359,8 +359,8 @@ else if ( selectable instanceof String ) {
359359 containingTableName ,
360360 columnsAndFormulasSource .getColumnAttribute (),
361361 columnsAndFormulasSource .getSizeSource (),
362- interpretNullabilityToTruthValue ( columnsAndFormulasSource .isNullable () ),
363- columnsAndFormulasSource .isUnique () ? TruthValue . TRUE : TruthValue . FALSE ,
362+ columnsAndFormulasSource .isNullable (),
363+ columnsAndFormulasSource .isUnique (),
364364 columnsAndFormulasSource .getIndexConstraintNames (),
365365 columnsAndFormulasSource .getUniqueKeyConstraintNames ()
366366 )
@@ -370,23 +370,14 @@ else if ( selectable instanceof String ) {
370370 return result ;
371371 }
372372
373- private static TruthValue interpretNullabilityToTruthValue (Boolean nullable ) {
374- if ( nullable == null ) {
375- return TruthValue .UNKNOWN ;
376- }
377- else {
378- return nullable ? TruthValue .TRUE : TruthValue .FALSE ;
379- }
380- }
381-
382373 private static void validateUseOfFormulaAttribute (
383374 MappingDocument sourceDocument ,
384375 ColumnsAndFormulasSource columnsAndFormulasSource ) {
385376 // 1) make sure there is no column attribute
386- if ( StringHelper . isNotEmpty ( columnsAndFormulasSource .getColumnAttribute () ) ) {
377+ if ( isNotEmpty ( columnsAndFormulasSource .getColumnAttribute () ) ) {
387378 final String errorMessage ;
388379 if ( columnsAndFormulasSource .getSourceType ().canBeNamed ()
389- && StringHelper . isNotEmpty ( columnsAndFormulasSource .getSourceName () ) ) {
380+ && isNotEmpty ( columnsAndFormulasSource .getSourceName () ) ) {
390381 errorMessage = String .format (
391382 Locale .ENGLISH ,
392383 "column attribute and formula attribute may not be specified together near <%s name=\" %s\" column=\" %s\" formula=\" %s\" />" ,
@@ -411,7 +402,7 @@ private static void validateUseOfFormulaAttribute(
411402 if ( CollectionHelper .isNotEmpty ( columnsAndFormulasSource .getColumnOrFormulaElements () ) ) {
412403 final String errorMessage ;
413404 if ( columnsAndFormulasSource .getSourceType ().canBeNamed ()
414- && StringHelper . isNotEmpty ( columnsAndFormulasSource .getSourceName () ) ) {
405+ && isNotEmpty ( columnsAndFormulasSource .getSourceName () ) ) {
415406 errorMessage = String .format (
416407 Locale .ENGLISH ,
417408 "formula attribute may not be specified along with <column/> or <formula/> subelement(s) near <%s name=\" %s\" formula=\" %s\" />" ,
@@ -435,10 +426,10 @@ private static void validateUseOfFormulaAttribute(
435426 private static void validateUseOfColumnOrFormulaNestedElements (
436427 MappingDocument sourceDocument ,
437428 ColumnsAndFormulasSource columnsAndFormulasSource ) {
438- if ( StringHelper . isNotEmpty ( columnsAndFormulasSource .getColumnAttribute () ) ) {
429+ if ( isNotEmpty ( columnsAndFormulasSource .getColumnAttribute () ) ) {
439430 final String errorMessage ;
440431 if ( columnsAndFormulasSource .getSourceType ().canBeNamed ()
441- && StringHelper . isNotEmpty ( columnsAndFormulasSource .getSourceName () ) ) {
432+ && isNotEmpty ( columnsAndFormulasSource .getSourceName () ) ) {
442433 errorMessage = String .format (
443434 Locale .ENGLISH ,
444435 "column attribute may not be specified along with <column/> or <formula/> subelement(s) near <%s name=\" %s\" column=\" %s\" />" ,
@@ -467,7 +458,7 @@ private static void validateCustomWriteFragment(
467458 if ( customWrite != null && !customWrite .matches ("[^?]*\\ ?[^?]*" ) ) {
468459 final String errorMessage ;
469460 if ( columnsAndFormulasSource .getSourceType ().canBeNamed ()
470- && StringHelper . isNotEmpty ( columnsAndFormulasSource .getSourceName () ) ) {
461+ && isNotEmpty ( columnsAndFormulasSource .getSourceName () ) ) {
471462 errorMessage = String .format (
472463 Locale .ENGLISH ,
473464 "write expression must contain exactly one value placeholder ('?') character near <column name=\" %s\" ... write=\" %s\" /> for <%s name=\" %s\" />" ,
0 commit comments