de.mguennewig.pobjects.metadata
Class JoinType

java.lang.Object
  extended by de.mguennewig.pobjects.metadata.JoinType
All Implemented Interfaces:
ReferenceToClass
Direct Known Subclasses:
MapType, NestedSetType, SetType, StackType

public abstract class JoinType
extends java.lang.Object
implements ReferenceToClass

Non scalar type denoting a join between two tables.

On the SQL level, this type is not materialized at all. The child table must follow a certain structure, depending on the type of the join. The parent table defines a join element using one of the subclasses of JoinType to declare the semantics of the relationship between the parent and child data.


Field Summary
static int CLASS_NAME
          Return the name of the Java class that holds the type information of this Type in the Java application.
static int TYPE_NAME
          Name of the Java type used to access values of this JoinType.
 
Constructor Summary
JoinType(java.lang.String targetModule, java.lang.String targetName, ClassDecl targetClass)
          Initialize join type.
 
Method Summary
 ClassDecl getTargetClass()
          Returns the class declaration of the referenced table.
 java.lang.String getTargetModule()
          Returns the name of the module to which the referenced table belongs.
 java.lang.String getTargetName()
          Returns the name of the class the pointer (or foreign key) refers to.
 java.lang.String name(int variant)
          Returns different names depending on variant for the code generator.
 void setTargetClass(ClassDecl targetClass)
          Sets the class declaration of the referenced table.
 void setTypeClass(java.lang.String typeClass)
          Sets the fully qualified class name of the type class that should be used instead of this one.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_NAME

public static final int TYPE_NAME
Name of the Java type used to access values of this JoinType.

See Also:
Constant Field Values

CLASS_NAME

public static final int CLASS_NAME
Return the name of the Java class that holds the type information of this Type in the Java application.

See Also:
Constant Field Values
Constructor Detail

JoinType

public JoinType(java.lang.String targetModule,
                java.lang.String targetName,
                ClassDecl targetClass)
Initialize join 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.
See Also:
setTargetClass(ClassDecl)
Method Detail

getTargetModule

public final java.lang.String getTargetModule()
Description copied from interface: ReferenceToClass
Returns the name of the module to which the referenced table belongs.

Specified by:
getTargetModule in interface ReferenceToClass
See Also:
ReferenceToClass.getTargetName(), ReferenceToClass.getTargetClass()

getTargetName

public final java.lang.String getTargetName()
Description copied from interface: ReferenceToClass
Returns the name of the class the pointer (or foreign key) refers to.

Specified by:
getTargetName in interface ReferenceToClass

getTargetClass

public final ClassDecl getTargetClass()
Returns the class declaration of the referenced table.

Specified by:
getTargetClass in interface ReferenceToClass
See Also:
setTargetClass(de.mguennewig.pobjects.metadata.ClassDecl)

setTargetClass

public void setTargetClass(ClassDecl targetClass)
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:

Specified by:
setTargetClass in interface ReferenceToClass
Throws:
java.lang.IllegalArgumentException - if the given target class does not fulfill the requirements of this join type.
java.lang.IllegalStateException - if target class is already set.

setTypeClass

public final void setTypeClass(java.lang.String typeClass)
Sets the fully qualified class name of the type class that should be used instead of this one.


name

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

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