77import java .util .Locale ;
88
99import org .hibernate .dialect .Dialect ;
10- import org .hibernate .internal .util .StringHelper ;
1110
11+ import static java .lang .Character .isLetter ;
12+ import static java .lang .Character .isLetterOrDigit ;
13+ import static java .lang .Character .isWhitespace ;
1214import static org .hibernate .internal .util .StringHelper .isBlank ;
15+ import static org .hibernate .internal .util .StringHelper .isEmpty ;
1316
1417/**
1518 * Models an identifier (name), which may or may not be quoted.
@@ -83,13 +86,13 @@ public static Identifier toIdentifier(String text, boolean quote, boolean quoteO
8386 int start = 0 ;
8487 int end = text .length ();
8588 while ( start < end ) {
86- if ( !Character . isWhitespace ( text .charAt ( start ) ) ) {
89+ if ( !isWhitespace ( text .charAt ( start ) ) ) {
8790 break ;
8891 }
8992 start ++;
9093 }
9194 while ( start < end ) {
92- if ( !Character . isWhitespace ( text .charAt ( end - 1 ) ) ) {
95+ if ( !isWhitespace ( text .charAt ( end - 1 ) ) ) {
9396 break ;
9497 }
9598 end --;
@@ -102,14 +105,14 @@ public static Identifier toIdentifier(String text, boolean quote, boolean quoteO
102105 else if ( quoteOnNonIdentifierChar && !quote ) {
103106 // Check the letters to determine if we must quote the text
104107 char c = text .charAt ( start );
105- if ( !Character . isLetter ( c ) && c != '_' ) {
108+ if ( !isLetter ( c ) && c != '_' ) {
106109 // SQL identifiers must begin with a letter or underscore
107110 quote = true ;
108111 }
109112 else {
110113 for ( int i = start + 1 ; i < end ; i ++ ) {
111114 c = text .charAt ( i );
112- if ( !Character . isLetterOrDigit ( c ) && c != '_' ) {
115+ if ( !isLetterOrDigit ( c ) && c != '_' ) {
113116 quote = true ;
114117 break ;
115118 }
@@ -163,7 +166,7 @@ public static String unQuote(String name) {
163166 * @param quoted Is this a quoted identifier?
164167 */
165168 public Identifier (String text , boolean quoted ) {
166- if ( StringHelper . isEmpty ( text ) ) {
169+ if ( isEmpty ( text ) ) {
167170 throw new IllegalIdentifierException ( "Identifier text cannot be null" );
168171 }
169172 if ( isQuoted ( text ) ) {
@@ -234,11 +237,9 @@ public String toString() {
234237
235238 @ Override
236239 public boolean equals (Object o ) {
237- if ( !(o instanceof Identifier ) ) {
240+ if ( !(o instanceof Identifier that ) ) {
238241 return false ;
239242 }
240-
241- final Identifier that = (Identifier ) o ;
242243 return getCanonicalName ().equals ( that .getCanonicalName () );
243244 }
244245
0 commit comments