de.mguennewig.pobjects.metadata
Class Constraint

java.lang.Object
  extended by de.mguennewig.pobjects.metadata.Constraint
Direct Known Subclasses:
CheckConstraint, ForeignKeyConstraint, UniqueConstraint

public abstract class Constraint
extends java.lang.Object

Abstract base class for a constraint definition.

Author:
Michael Günnewig

Field Summary
static int MEMBER_NAME
          The name for the class member that holds this constraint.
 
Constructor Summary
Constraint(java.lang.String schemaName, boolean implicit)
          Creates a new constraint.
 
Method Summary
abstract  void check(Record obj)
          Checks whether the constraint is fulfilled for the given object.
 java.lang.String getSchemaName()
          Returns the constraint name within the database schema.
 boolean isImplicit()
          Returns whether this constraint has been created implicit.
abstract  java.lang.String name(ClassDecl cd, int variant)
          Returns different names depending on variant for the code generator.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MEMBER_NAME

public static final int MEMBER_NAME
The name for the class member that holds this constraint.

See Also:
Constant Field Values
Constructor Detail

Constraint

public Constraint(java.lang.String schemaName,
                  boolean implicit)
Creates a new constraint.

Parameters:
schemaName - The constraint name within the database schema.
implicit - Whether this constraint has been created implicit.
Method Detail

getSchemaName

public final java.lang.String getSchemaName()
Returns the constraint name within the database schema.


isImplicit

public final boolean isImplicit()
Returns whether this constraint has been created implicit.


check

public abstract void check(Record obj)
                    throws PObjConstraintException
Checks whether the constraint is fulfilled for the given object.

Throws:
PObjConstraintException - when the constraint isn't fulfilled.

name

public abstract java.lang.String name(ClassDecl cd,
                                      int variant)
Returns different names depending on variant for the code generator.

Throws:
java.lang.IllegalArgumentException - if variant is unknown.