de.mguennewig.pobjects.metadata
Class PrimaryKeyConstraint
java.lang.Object
de.mguennewig.pobjects.metadata.Constraint
de.mguennewig.pobjects.metadata.UniqueConstraint
de.mguennewig.pobjects.metadata.PrimaryKeyConstraint
public class PrimaryKeyConstraint
- extends UniqueConstraint
A primary key constraint is a UniqueConstraint which also forbids
null values.
- Author:
- Michael Günnewig
|
Method Summary |
void |
check(Record obj)
Checks whether the constraint is fulfilled for the given Record. |
java.lang.String |
name(ClassDecl cl,
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 |
PrimaryKeyConstraint
public PrimaryKeyConstraint(java.lang.String schemaName,
Field[] fields)
- Creates a new primary-key constraint.
- Parameters:
schemaName - The constraint name within the database schema.fields - The fields belonging to this constraint.
PrimaryKeyConstraint
public PrimaryKeyConstraint(java.lang.String schemaName,
IdField idfield)
- Creates the implicit primary-key constraint for the id field.
check
public void check(Record obj)
throws PObjConstraintException
- Checks whether the constraint is fulfilled for the given
Record.
As we can't check for uniqueness we only check whether each field
is NOT NULL.
- Overrides:
check in class UniqueConstraint
- Throws:
PObjConstraintException - when the constraint isn't fulfilled.
name
public java.lang.String name(ClassDecl cl,
int variant)
- Returns different names depending on
variant for the code
generator.
- Overrides:
name in class UniqueConstraint
- Returns: