de.mguennewig.pobjects.metadata
Class TableExpr

java.lang.Object
  extended by de.mguennewig.pobjects.metadata.Declaration
      extended by de.mguennewig.pobjects.metadata.TableExpr
All Implemented Interfaces:
SqlEntity
Direct Known Subclasses:
ClassDecl, SelectExpr

public abstract class TableExpr
extends Declaration
implements SqlEntity

Abstract base class for all table expressions.

Author:
Michael Günnewig

Field Summary
 
Fields inherited from class de.mguennewig.pobjects.metadata.Declaration
ARGUMENT_CONSTRUCTOR, CLASS_NAME, DESCRIPTOR, GENERATED_CLASS_NAME, POINTER_TYPE, SQL_ARG_COLON, SQL_ARG_DOLLAR, SQL_ARG_NONE, SQL_ARG_QUESTION_MARK
 
Constructor Summary
TableExpr(java.lang.String name)
          Creates a new table expression.
 
Method Summary
 java.lang.String getClassName()
          Returns the Java class name for this table expression.
abstract  Column getColumn(int index)
           
abstract  Column getColumnByName(java.lang.String name)
          Return table column with name name.
abstract  int getNumColumns()
           
abstract  java.lang.String getSqlFromClause(int sqlArgVariant)
           
 boolean isExtensionOf(TableExpr te)
          Tests whether this table expression is an extension of te.
 boolean isWritableClass()
          Tests whether this table expression is an ClassDecl that can also be updated.
 java.lang.String name(int variant)
          Returns different names depending on variant for the code generator.
 void setModule(Module module)
          Sets the owning module and resolves the type name.
 
Methods inherited from class de.mguennewig.pobjects.metadata.Declaration
getDescription, getModule, getName, setDescription, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.mguennewig.pobjects.metadata.SqlEntity
getModule, getSchemaName
 

Constructor Detail

TableExpr

public TableExpr(java.lang.String name)
Creates a new table expression.

Method Detail

isExtensionOf

public boolean isExtensionOf(TableExpr te)
Tests whether this table expression is an extension of te.

Returns:
true if te either equals this, or is a base table of this, otherwise false.

isWritableClass

public boolean isWritableClass()
Tests whether this table expression is an ClassDecl that can also be updated. Only these tables are mapped onto PObject instances, all others are read-only and retrieved as Record objects.


getNumColumns

public abstract int getNumColumns()

getColumn

public abstract Column getColumn(int index)

getColumnByName

public abstract Column getColumnByName(java.lang.String name)
Return table column with name name. If no such column exists, result is null.


getSqlFromClause

public abstract java.lang.String getSqlFromClause(int sqlArgVariant)

getClassName

public final java.lang.String getClassName()
Returns the Java class name for this table expression. Query results derived from it are returned in instances of this class.

Throws:
java.lang.IllegalStateException - if setModule(de.mguennewig.pobjects.metadata.Module) has not been called yet.

setModule

public void setModule(Module module)
Sets the owning module and resolves the type name.

Specified by:
setModule in interface SqlEntity
Overrides:
setModule in class Declaration

name

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

Specified by:
name in class Declaration
Returns:
variant return value
Declaration.POINTER_TYPE <JavaPackage>.<Name>
Declaration.CLASS_NAME <Name>
Declaration.GENERATED_CLASS_NAME PClass<Name>