de.mguennewig.pobjects.metadata
Class NestedSetType

java.lang.Object
  extended by de.mguennewig.pobjects.metadata.JoinType
      extended by de.mguennewig.pobjects.metadata.NestedSetType
All Implemented Interfaces:
ReferenceToClass

public class NestedSetType
extends JoinType

Rows of the target table represent a nested set associated with the parent table.

The target table must fulfill multiple requirements that are described in setTargetClass(ClassDecl).

Author:
Michael Günnewig

Field Summary
 
Fields inherited from class de.mguennewig.pobjects.metadata.JoinType
CLASS_NAME, TYPE_NAME
 
Constructor Summary
NestedSetType(java.lang.String targetModule, java.lang.String targetName, ClassDecl targetClass, java.lang.String rightColumnName)
          Initialize a nested set type.
 
Method Summary
 Column getLeftColumn()
          Returns the column that holds the left most subset.
 Column getRightColumn()
          Returns the column that holds the right most subset.
 java.lang.String name(int variant)
          Returns different names depending on variant for the code generator.
 void setTargetClass(ClassDecl te)
          Sets the class declaration of the referenced table.
 
Methods inherited from class de.mguennewig.pobjects.metadata.JoinType
getTargetClass, getTargetModule, getTargetName, setTypeClass
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NestedSetType

public NestedSetType(java.lang.String targetModule,
                     java.lang.String targetName,
                     ClassDecl targetClass,
                     java.lang.String rightColumnName)
Initialize a nested set type.

Parameters:
targetModule - Module of the target class.
targetName - The name of the class the join refers to.
targetClass - The class declaration of the referenced table. This must be given or null with a later call to setTargetClass(ClassDecl) before any usage of this type.
rightColumnName - The column that holds the right subset.
See Also:
setTargetClass(ClassDecl)
Method Detail

getLeftColumn

public final Column getLeftColumn()
Returns the column that holds the left most subset.


getRightColumn

public final Column getRightColumn()
Returns the column that holds the right most subset.


setTargetClass

public void setTargetClass(ClassDecl te)
Sets the class declaration of the referenced table.

A call to this method is only necessary if the class declaration has not been passed to the constructor to solve circle problems.

The referenced table must fulfill a couple of requirements depending on join type. The following requirements are common for all:

In addition to the generic restrictions a nested set adds the following:

Specified by:
setTargetClass in interface ReferenceToClass
Overrides:
setTargetClass in class JoinType

name

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

Overrides:
name in class JoinType