Package com.im.commons.db.util
Class SchemaQualifiedName
- java.lang.Object
-
- com.im.commons.db.util.SchemaQualifiedName
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<SchemaQualifiedName>
public final class SchemaQualifiedName extends java.lang.Object implements java.lang.Comparable<SchemaQualifiedName>, java.io.Serializable
Schema qualified table name representation.- Author:
- pzajac
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SchemaQualifiedName(DBTableInfo ti)
SchemaQualifiedName(java.lang.String schema, java.lang.String table)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
addSchemaToTableIfMissing(java.lang.String schema, java.lang.String tableName)
int
compareTo(SchemaQualifiedName o)
boolean
equals(java.lang.Object obj)
boolean
equals(java.lang.String fkSchemaName, java.lang.String fkTableName)
java.lang.String
getEscapedSQN(java.lang.String quoteString)
java.lang.String
getSchema()
java.lang.String
getTable()
int
hashCode()
static java.lang.String
schemaPlusTable(java.lang.String schema, java.lang.String table)
static java.lang.String[]
splitSchemaFromTable(java.lang.String schemaPlusTable)
Splits the schema name from the table name.java.lang.String
toString()
static SchemaQualifiedName
valueOf(java.lang.String schemaQualifiedName)
-
-
-
Constructor Detail
-
SchemaQualifiedName
public SchemaQualifiedName(java.lang.String schema, java.lang.String table)
-
SchemaQualifiedName
public SchemaQualifiedName(DBTableInfo ti)
-
-
Method Detail
-
getSchema
public java.lang.String getSchema()
-
getTable
public java.lang.String getTable()
-
valueOf
public static SchemaQualifiedName valueOf(java.lang.String schemaQualifiedName)
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- Returns:
- schema qualified name in form of schema.tableName
-
equals
public boolean equals(java.lang.String fkSchemaName, java.lang.String fkTableName)
-
compareTo
public int compareTo(SchemaQualifiedName o)
- Specified by:
compareTo
in interfacejava.lang.Comparable<SchemaQualifiedName>
-
addSchemaToTableIfMissing
public static java.lang.String addSchemaToTableIfMissing(java.lang.String schema, java.lang.String tableName)
-
splitSchemaFromTable
public static java.lang.String[] splitSchemaFromTable(java.lang.String schemaPlusTable)
Splits the schema name from the table name. For a schema qualified table ("FOO.BAR") returns FOO as first element and BAR as second. For a name without a schema prefix ("BAR") returns null as the first element and BAR as second.- Parameters:
schemaPlusTable
- The name to split.- Returns:
- First element is schema, second is table
-
schemaPlusTable
public static java.lang.String schemaPlusTable(java.lang.String schema, java.lang.String table)
-
getEscapedSQN
public java.lang.String getEscapedSQN(java.lang.String quoteString)
- Parameters:
quoteString
- a single-char quoteString- Returns:
- a string representation of SQN, escaped with provided quoteString
-
-