Package org.hibernate.boot.model.naming
Class Identifier
- java.lang.Object
-
- org.hibernate.boot.model.naming.Identifier
-
- All Implemented Interfaces:
java.lang.Comparable<Identifier>
- Direct Known Subclasses:
DatabaseIdentifier
public class Identifier extends java.lang.Object implements java.lang.Comparable<Identifier>
Models an identifier (name), which may or may not be quoted.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Identifier(java.lang.String text)
Constructs an unquoted identifier instance.Identifier(java.lang.String text, boolean quoted)
Constructs an identifier instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
areEqual(Identifier id1, Identifier id2)
int
compareTo(Identifier o)
boolean
equals(java.lang.Object o)
java.lang.String
getCanonicalName()
java.lang.String
getText()
Get the identifiers name (text)int
hashCode()
boolean
isQuoted()
Is this a quoted identifier>static boolean
isQuoted(java.lang.String name)
Is the given identifier text considered quoted.static Identifier
quote(Identifier identifier)
java.lang.String
render()
java.lang.String
render(Dialect dialect)
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 Identifier
toIdentifier(java.lang.String text)
Means to generate anIdentifier
instance from its simple text form.static Identifier
toIdentifier(java.lang.String text, boolean quote)
Means to generate anIdentifier
instance from its simple text form.java.lang.String
toString()
-
-
-
Constructor Detail
-
Identifier
public Identifier(java.lang.String text, boolean quoted)
Constructs an identifier instance.- Parameters:
text
- The identifier text.quoted
- Is this a quoted identifier?
-
Identifier
protected Identifier(java.lang.String text)
Constructs an unquoted identifier instance.- Parameters:
text
- The identifier text.
-
-
Method Detail
-
toIdentifier
public static Identifier toIdentifier(java.lang.String text)
Means to generate anIdentifier
instance from its simple text form. If passed text isnull
,null
is returned. If passed text is surrounded in quote markers, the generated Identifier is considered quoted. Quote markers include back-ticks (`), and double-quotes (").- Parameters:
text
- The text form- Returns:
- The identifier form, or
null
if text wasnull
-
toIdentifier
public static Identifier toIdentifier(java.lang.String text, boolean quote)
Means to generate anIdentifier
instance from its simple text form. If passed text isnull
,null
is returned. If passed text is surrounded in quote markers, the generated Identifier is considered quoted. Quote markers include back-ticks (`), and double-quotes (").- Parameters:
text
- The text formquote
- Whether to quote unquoted text forms- Returns:
- The identifier form, or
null
if text wasnull
-
isQuoted
public static boolean isQuoted(java.lang.String name)
Is the given identifier text considered quoted. The following patterns are recognized as quoted:`name`
[name]
"name"
- Parameters:
name
-- Returns:
-
getText
public java.lang.String 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.
-
render
public java.lang.String render(Dialect dialect)
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
public java.lang.String render()
-
getCanonicalName
public java.lang.String getCanonicalName()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
areEqual
public static boolean areEqual(Identifier id1, Identifier id2)
-
quote
public static Identifier quote(Identifier identifier)
-
compareTo
public int compareTo(Identifier o)
- Specified by:
compareTo
in interfacejava.lang.Comparable<Identifier>
-
-