net.sourceforge.jdbdump.dump
Class Constraint

java.lang.Object
  extended by net.sourceforge.jdbdump.dump.Constraint
All Implemented Interfaces:
java.io.Serializable

public class Constraint
extends java.lang.Object
implements java.io.Serializable

Represents a table or column constraint.

A constraint can be assigned either to a single column (e.g. "..., cash integer CHECK (cash > 0), ...") or to the entire table (e.g. "..., CONSTRAINT table_pkey PRIMARY KEY (id), ..."). It has three attributes: its name (not always used, in the second example that would be "table_pkey"), its text (entire SQL expression used in create table command), and its type which can be PRIMARE_KEY, FOREIGN_KEY or OTHER.

Author:
jsuder
See Also:
Serialized Form

Nested Class Summary
static class Constraint.ConstraintType
          A category to which this constraint belongs.
 
Constructor Summary
Constraint(java.lang.String name, Constraint.ConstraintType type, java.lang.String fullText)
          Creates a new constraint with a given name, type and contents.
 
Method Summary
 java.lang.String getName()
          Returns this constraint's name.
 java.lang.String getText()
          Returns this constraint's command.
 Constraint.ConstraintType getType()
          Returns this constraint's type ((see ConstraintType enum).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Constraint

public Constraint(java.lang.String name,
                  Constraint.ConstraintType type,
                  java.lang.String fullText)
Creates a new constraint with a given name, type and contents.

Parameters:
name - the constraint's name (may be empty)
type - constraint type (see enum ConstraintType description)
fullText - SQL expression used in create table command to add this constraint
Method Detail

getText

public java.lang.String getText()
Returns this constraint's command.

Returns:
a part of the CREATE TABLE command which refers to this constraint

getName

public java.lang.String getName()
Returns this constraint's name.

Returns:
constraint's name

getType

public Constraint.ConstraintType getType()
Returns this constraint's type ((see ConstraintType enum).

Returns:
constraint's type


Copyright © 2005-2006 AGH International University of Science and Technology. All Rights Reserved.