public class Identifier extends Object implements Comparable<Identifier>
Models an identifier (name), which may or may not be quoted.
| Modifier | Constructor and Description |
|---|---|
protected |
Identifier(String text)
Constructs an unquoted identifier instance.
|
|
Identifier(String text,
boolean quoted)
Constructs an identifier instance.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
areEqual(Identifier id1,
Identifier id2) |
int |
compareTo(Identifier o) |
boolean |
equals(Object o) |
String |
getCanonicalName() |
String |
getText()
Get the identifiers name (text)
|
int |
hashCode() |
boolean |
isQuoted()
Is this a quoted identifier>
|
static boolean |
isQuoted(String name)
Is the given identifier text considered quoted.
|
static Identifier |
quote(Identifier identifier) |
String |
render() |
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(String text)
Means to generate an
Identifier instance from its simple text form. |
static Identifier |
toIdentifier(String text,
boolean quote)
Means to generate an
Identifier instance from its simple text form. |
String |
toString() |
public Identifier(String text, boolean quoted)
Constructs an identifier instance.
text - The identifier text.quoted - Is this a quoted identifier?protected Identifier(String text)
Constructs an unquoted identifier instance.
text - The identifier text.public static Identifier toIdentifier(String text)
Means to generate an Identifier instance from its simple text form.
<p/>
If passed text is null, null is returned.
<p/>
If passed text is surrounded in quote markers, the generated Identifier
is considered quoted. Quote markers include back-ticks (`), and
double-quotes (").
text - The text formnull if text was nullpublic static Identifier toIdentifier(String text, boolean quote)
Means to generate an Identifier instance from its simple text form.
<p/>
If passed text is null, null is returned.
<p/>
If passed text is surrounded in quote markers, the generated Identifier
is considered quoted. Quote markers include back-ticks (`), and
double-quotes (").
text - The text formquote - Whether to quote unquoted text formsnull if text was nullpublic static boolean isQuoted(String name)
Is the given identifier text considered quoted. The following patterns are
recognized as quoted:<ul>
<li><code>name</code></li>
<li>[name]</li>
<li>"name"</li>
</ul>
<p/>
That final form using double-quote (") is the JPA-defined quoting pattern. Although
it is the standard, it makes for ugly declarations.
name - public String getText()
Get the identifiers name (text)
public boolean isQuoted()
Is this a quoted identifier>
public 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.
dialect - The dialect whose dialect-specific quoting should be used.public String render()
public String getCanonicalName()
public static boolean areEqual(Identifier id1, Identifier id2)
public static Identifier quote(Identifier identifier)
public int compareTo(Identifier o)
compareTo in interface Comparable<Identifier>Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.