Class QualifiedTableName

java.lang.Object
org.dbunit.util.QualifiedTableName

public class QualifiedTableName extends Object
Utility to parse a fully qualified table name into its components schema and table.
Since:
2.3.0
Version:
$Revision$ $Date$
Author:
gommma, Last changed by: $Author$
  • Constructor Details

    • QualifiedTableName

      public QualifiedTableName(String tableName, String defaultSchema)
      Creates an object parsing the given tableName.
      Parameters:
      tableName - The table name, either qualified or unqualified. If it is qualified (like "MYSCHEMA.MYTABLE") this schema name has precedence before the given defaultSchema parameter.
      defaultSchema - The schema that is used when the given tableName is not fully qualified (i.e. it is not like "MYSCHEMA.MYTABLE"). Can be null
    • QualifiedTableName

      public QualifiedTableName(String tableName, String defaultSchema, String escapePattern)
      Creates an object parsing the given tableName.
      Parameters:
      tableName - The table name, either qualified or unqualified. If it is qualified (like "MYSCHEMA.MYTABLE") this schema name has precedence before the given defaultSchema parameter.
      defaultSchema - The schema that is used when the given tableName is not fully qualified (i.e. it is not like "MYSCHEMA.MYTABLE"). Can be null
      escapePattern - The escape pattern to be applied on the prefix and the name. Can be null.
  • Method Details

    • getSchema

      public String getSchema()
      Returns:
      The schema name which can be null if no schema has been given in the constructor
    • getTable

      public String getTable()
      Returns:
      The name of the plain, unqualified table
    • getQualifiedName

      public String getQualifiedName()
      Returns:
      The qualified table name with the prepended schema if a schema is available
    • getQualifiedNameIfEnabled

      public String getQualifiedNameIfEnabled(DatabaseConfig config)
      Returns the qualified name using the values given in the constructor. The qualified table name is only returned if the feature DatabaseConfig.FEATURE_QUALIFIED_TABLE_NAMES is set. Otherwise the given name is returned unqualified (i.e. without prepending the prefix/schema).
      Returns:
      The qualified table name with the prepended schema if a schema is available. The qualified table name is only returned if the feature DatabaseConfig.FEATURE_QUALIFIED_TABLE_NAMES is set in the given config.
    • toString

      public String toString()
      Overrides:
      toString in class Object