Class Identifier
- All Implemented Interfaces:
Comparable<Identifier>
- Direct Known Subclasses:
DatabaseIdentifier
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedIdentifier(String text) Constructs an unquoted identifier instance.Identifier(String text, boolean quoted) Constructs an identifier instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanareEqual(Identifier id1, Identifier id2) intcompareTo(Identifier identifier) booleangetText()Get the identifiers name (text)inthashCode()booleanisQuoted()Is this a quoted identifier?static booleanIs the given identifier text considered quoted.static booleanbooleanstatic Identifierquote(Identifier identifier) Deprecated, for removal: This API element is subject to removal in a future version.quoted()A quoted form of this identifier.render()If this is a quoted identifier, then return the identifier name enclosed in dialect-specific open- and end-quotes; otherwise, simply return the unquoted identifier.static IdentifiertoIdentifier(String text) Means to generate anIdentifierinstance from its simple text form.static IdentifiertoIdentifier(String text, boolean quote) Means to generate anIdentifierinstance from its simple text form.static IdentifiertoIdentifier(String text, boolean quote, boolean autoquote) Means to generate anIdentifierinstance from its simple text form.toString()static String
-
Constructor Details
-
Identifier
Constructs an identifier instance.- Parameters:
text- The identifier text.quoted- Is this a quoted identifier?
-
Identifier
Constructs an unquoted identifier instance.- Parameters:
text- The identifier text.
-
-
Method Details
-
toIdentifier
Means to generate anIdentifierinstance from its simple text form.If passed text is
null,nullis returned.If passed text is surrounded in quote markers, the generated Identifier is considered quoted. Quote markers include back-ticks (`), double-quotes (") and brackets ([ and ]). If the text, after trimming, contains a character that is not a valid identifier character, the identifier is treated as quoted.
- Parameters:
text- The text form- Returns:
- The identifier form, or
nullif text wasnull
-
toIdentifier
Means to generate anIdentifierinstance from its simple text form.If passed text is
null,nullis returned.If passed text is surrounded in quote markers, the generated Identifier is considered quoted. Quote markers include back-ticks (`), double-quotes (") and brackets ([ and ]). If the text, after trimming, contains a character that is not a valid identifier character, the identifier is treated as quoted.
- Parameters:
text- The text formquote- Whether to quote unquoted text forms- Returns:
- The identifier form, or
nullif text wasnull
-
toIdentifier
Means to generate anIdentifierinstance from its simple text form.If passed
textisnull,nullis returned.If passed
textis surrounded in quote markers, the returned Identifier is considered quoted. Quote markers include back-ticks (`), double-quotes ("), and brackets ([ and ]).- Parameters:
text- The text formquote- Whether to quote unquoted text formsautoquote- Whether to quote the result if it contains special characters- Returns:
- The identifier form, or
nullif text wasnull
-
isQuoted
Is the given identifier text considered quoted. The following patterns are recognized as quoted:`name`[name]"name"
That final form using double-quote (") is the JPA-defined quoting pattern. Although it is the standard, it makes for ugly declarations.
- Returns:
trueif the given identifier text is considered quoted;falseotherwise.
-
isQuoted
-
unQuote
-
getText
Get the identifiers name (text)- Returns:
- The name
-
isQuoted
public boolean isQuoted()Is this a quoted identifier?- Returns:
- True if this is a quote identifier; false otherwise.
-
quoted
A quoted form of this identifier. -
render
If this is a quoted identifier, then return the identifier name enclosed in dialect-specific open- and end-quotes; otherwise, simply return the unquoted identifier.- Parameters:
dialect- The dialect whose dialect-specific quoting should be used.- Returns:
- if quoted, identifier name enclosed in dialect-specific open- and end-quotes; otherwise, the unquoted identifier.
-
render
-
getCanonicalName
-
toString
-
equals
-
matches
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareToin interfaceComparable<Identifier>
-
areEqual
-
quote
Deprecated, for removal: This API element is subject to removal in a future version.Usequoted().
-
quoted().