de.fesenmeyer.dbnormalizer.core
Class TableContainer

java.lang.Object
  extended by de.fesenmeyer.dbnormalizer.core.AbstractDBItem
      extended by de.fesenmeyer.dbnormalizer.core.TableContainer
All Implemented Interfaces:
Comparable<TableContainer>

public class TableContainer
extends AbstractDBItem
implements Comparable<TableContainer>

A TableContainer is used to group tables based on the schema or catalog they are contained in. This class is mainly used by the DBNormalizerSession and Table classes. The TableContainer NO_CONTAINER can be used as group for tables which are neither contained in a schema nor catalog.

Author:
DF
See Also:
TableContainerType

Field Summary
static TableContainer NO_CONTAINER
          The TableContainer to be used for tables neither contained in a catalog nor schema.
private static String NO_CONTAINER_NAME
          The name of the container NO_CONTAINER.
private  TableContainerType type
          The type.
 
Constructor Summary
TableContainer(String name, TableContainerType type)
          Class Constructor specifying name and type.
 
Method Summary
 int compareTo(TableContainer tableContainer)
          Compares this TableContainer to another by comparing type and name.
 boolean equals(Object o)
          Overridden method, tests if the TableContainer specified by argument o is equal to this TableContainer.
 TableContainerType getType()
          Gets the type.
 String toString()
          Overridden method, returns an appropriate string representation of this TableContainer.
 
Methods inherited from class de.fesenmeyer.dbnormalizer.core.AbstractDBItem
getName, setName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

type

private TableContainerType type
The type.


NO_CONTAINER_NAME

private static final String NO_CONTAINER_NAME
The name of the container NO_CONTAINER.

See Also:
Constant Field Values

NO_CONTAINER

public static final TableContainer NO_CONTAINER
The TableContainer to be used for tables neither contained in a catalog nor schema.

Constructor Detail

TableContainer

public TableContainer(String name,
                      TableContainerType type)
Class Constructor specifying name and type.

NOTE: For specifying a TableContainer of type TableContainerType.NONE the constant NO_CONTAINER must be used instead of this constructor, because a name does not make sense for this type. Otherwise an IllegalArgumentException will be thrown.

Parameters:
name - the name
type - the type
Throws:
IllegalArgumentException - if the name argument or type argument are null, or if type is TableContainerType.NONE
Method Detail

getType

public TableContainerType getType()
Gets the type.

Returns:
the type

equals

public boolean equals(Object o)
Overridden method, tests if the TableContainer specified by argument o is equal to this TableContainer.

Overrides:
equals in class Object
Parameters:
o - an Object, which should be another TableContainer
Returns:
true, if the o argument is not null, a TableContainer and its type and name is equal to this TableContainer; false, otherwise

toString

public String toString()
Overridden method, returns an appropriate string representation of this TableContainer.

Overrides:
toString in class AbstractDBItem
Returns:
the string representation of this TableContainer.

compareTo

public int compareTo(TableContainer tableContainer)
Compares this TableContainer to another by comparing type and name.

Specified by:
compareTo in interface Comparable<TableContainer>
Parameters:
tableContainer - another TableContainer.
Returns:
Returns
  • an int value smaller than 0, if
    • this one's type is smaller than the other one's type or
    • if the types are equal and this one's name is smaller than the other one's name.
  • 0, if the tables' type and name are both equal.
  • an int value greater than 0, if
    • this one's type is greater than the other one's type or
    • if the types are equal and this one's name is greater than the other one's name.