de.mguennewig.pobjects
Class Pclass

java.lang.Object
  extended by de.mguennewig.pobjects.Record
      extended by de.mguennewig.pobjects.PObject
          extended by de.mguennewig.pobjects.Pclass

public final class Pclass
extends PObject

PObject interface class to access the internal tables for DBMS, which do not support inheritance.

This class can be used to influence in more detail what subclasses of an extensible class should be returned by a query.

Author:
Michael Günnewig

Field Summary
static IdField attrId
          Contains the definition for id.
static Field attrTableName
          Contains the definition for tableName.
static Int32Type atypeId
          Contains the type definition for id.
static StringType atypeTableName
          Contains the type definition for tableName.
static ClassDecl cdeclPclass
          Contains the metadata used to create this class.
static UniqueConstraint uniquePclassTableName
           
 
Fields inherited from class de.mguennewig.pobjects.PObject
CHECK_ALL_FIELDS, CHECK_CHANGED_ONLY, CHECK_NOTHING, STATE_COMMITED, STATE_DELETE, STATE_DIRTY, STATE_INTERNALIZED, STATE_INVALID, STATE_NEW_OBJECT, STATE_REFERENCE, STATE_TRANSIENT
 
Constructor Summary
Pclass()
          Creates a new Pclass instance with default values.
Pclass(java.lang.String tableName)
          Creates a new Pclass instance with all values specified.
 
Method Summary
static Pclass findByName(Container db, java.lang.String tableName)
          Finds the Pclass instance for the given table name.
static Pclass findForTable(Container db, ClassDecl te)
          Finds the Pclass instance for the given table.
 java.lang.Object get(int i)
          Returns the value of the column with index i.
 ClassDecl getClassDecl()
          Returns the metadata used to create this class.
 ClassDecl getTableForThis()
          Returns the table declaration of the table described by this instance.
 java.lang.String getTableName()
          Returns the value of tableName.
 java.lang.String getTableNameForVisual()
          Returns the preferred string representation of tableName.
 void set(int i, java.lang.Object value)
          Set value of field with index index.
 void setTableName(java.lang.String v)
          Sets the value for tableName.
 
Methods inherited from class de.mguennewig.pobjects.PObject
checkConstraints, checkConstraints, copyState, delete, getChangedValues, getContainer, getDefaultFieldCheckStyle, getId, getIdForVisual, getKey, getKey, getOldValues, getPObjState, getTableExpr, isInstanceOf, isInternalized, isPersistent, isReference, loadForUpdate, loadIfReference, revert, set, setDefaultFieldCheckStyle, store, store, toString
 
Methods inherited from class de.mguennewig.pobjects.Record
format, get
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

atypeId

public static final Int32Type atypeId
Contains the type definition for id.


attrId

public static final IdField attrId
Contains the definition for id.

See Also:
atypeId

atypeTableName

public static final StringType atypeTableName
Contains the type definition for tableName.


attrTableName

public static final Field attrTableName
Contains the definition for tableName.

See Also:
atypeTableName

uniquePclassTableName

public static final UniqueConstraint uniquePclassTableName

cdeclPclass

public static final ClassDecl cdeclPclass
Contains the metadata used to create this class.

Constructor Detail

Pclass

public Pclass()
Creates a new Pclass instance with default values.


Pclass

public Pclass(java.lang.String tableName)
Creates a new Pclass instance with all values specified.

Parameters:
tableName - The table name of the specific instance.
Method Detail

getClassDecl

public ClassDecl getClassDecl()
Returns the metadata used to create this class.

Specified by:
getClassDecl in class PObject

getTableName

public java.lang.String getTableName()
Returns the value of tableName.

This method ensures that all data will be read from the DBMS if not already done.

Throws:
PObjReadError - if a database error occurs.

getTableNameForVisual

public java.lang.String getTableNameForVisual()
Returns the preferred string representation of tableName.

Throws:
PObjReadError - if a database error occurs.
See Also:
getTableName()

setTableName

public void setTableName(java.lang.String v)
Sets the value for tableName.

This method ensures that all data will be read from the DBMS if not already done, before changing the field.

Throws:
PObjReadError - if a database error occurs.

get

public java.lang.Object get(int i)
Returns the value of the column with index i.

Specified by:
get in class Record
Throws:
java.lang.IndexOutOfBoundsException - if no column with index i exists.

set

public void set(int i,
                java.lang.Object value)
Description copied from class: Record
Set value of field with index index.

This method is primarily intended for use by procedures that work on meta level of de.mguennewig.pobjects. It differs from the per field setXXX() methods in that it does not load the object's data if it is not in memory. If unsure whether the object's state has been internalized, then any call to this method must be preceded by a call to PObject.loadIfReference().

Specified by:
set in class Record

getTableForThis

public ClassDecl getTableForThis()
Returns the table declaration of the table described by this instance.

Returns:
The metadata for the table or null if it is not known to the container.
See Also:
Container.getClassDecl(String)

findForTable

public static Pclass findForTable(Container db,
                                  ClassDecl te)
Finds the Pclass instance for the given table.

Parameters:
db - The database connection to use.
te - the table for which the pclass_ entry should be returned.
Returns:
The desired instance or null if it does not exist.
Throws:
PObjReadError - if any database error occurs.

findByName

public static Pclass findByName(Container db,
                                java.lang.String tableName)
Finds the Pclass instance for the given table name.

Parameters:
db - The database connection to use.
tableName - the table name for which the pclass_ entry should be returned.
Returns:
The desired instance or null if it does not exist.
Throws:
PObjReadError - if any database error occurs.