org.d2rq.db.schema
Class Identifier

java.lang.Object
  extended by org.d2rq.db.schema.Identifier
All Implemented Interfaces:
Comparable<Identifier>

public class Identifier
extends Object
implements Comparable<Identifier>

The name of a SQL object, such as a column, table, view, schema, or catalog. This may include appropriate quotation marks around the identifier. A SQL identifier must match the "identifier" production in [SQL2]. When comparing identifiers for equality, the comparison rules of [SQL2] must be used. "A", a and A are all considered equal for purposes of equals(java.lang.Object) and compareTo(org.d2rq.db.schema.Identifier), but "a" equals neither of them.

Author:
Richard Cyganiak (richard@cyganiak.de)

Nested Class Summary
static class Identifier.IdentifierParseException
           
static class Identifier.ViolationType
           
 
Method Summary
 int compareTo(Identifier o)
           
static Identifier create(boolean delimited, String name)
          Caller must ensure that the name is valid.
static Identifier createDelimited(String name)
          Caller must ensure that the name is valid.
static Identifier createUndelimited(String name)
          Caller must ensure that the name is valid.
 boolean equals(Object otherObject)
           
 String getCanonicalName()
          Case-normalized form if case-insensitive.
 String getName()
          General display name.
 int hashCode()
           
 boolean isDelimited()
          Is this a delimited identifier (case-sensitive, written with double-quotes in standard SQL)?
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

createDelimited

public static Identifier createDelimited(String name)
Caller must ensure that the name is valid.

Parameters:
name - The identifier's name, without delimiters and unescaped
Returns:
A matching Identifier instance, or null if name was null

createUndelimited

public static Identifier createUndelimited(String name)
Caller must ensure that the name is valid.

Parameters:
name - The identifier's name, without delimiters and unescaped
Returns:
A matching Identifier instance, or null if name was null

create

public static Identifier create(boolean delimited,
                                String name)
Caller must ensure that the name is valid.

Parameters:
delimited - Is this a delimited identifier as per SQL spec?
name - The identifier's name, without delimiters and unescaped
Returns:
A matching Identifier instance, or null if name was null

getName

public String getName()
General display name. Does not include delimiters. Not suitable for use in SQL queries.


getCanonicalName

public String getCanonicalName()
Case-normalized form if case-insensitive. Does not include delimiters. Not suitable for use in SQL queries as no escaping is performed.


isDelimited

public boolean isDelimited()
Is this a delimited identifier (case-sensitive, written with double-quotes in standard SQL)?


toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object otherObject)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

compareTo

public int compareTo(Identifier o)
Specified by:
compareTo in interface Comparable<Identifier>