org.objectweb.speedo.metadata
Class SpeedoInheritance

java.lang.Object
  extended by org.objectweb.speedo.metadata.SpeedoElement
      extended by org.objectweb.speedo.metadata.SpeedoInheritance
All Implemented Interfaces:
java.io.Serializable

public class SpeedoInheritance
extends SpeedoElement

Defines a the Speedo meta information about the inheritance. There is 3 possible mappings - The first mapping is the horizontal. Each concrete class has its own table containg all fields (fields of the class + inherited fields). The strategy for this mapping is new-table for each class. In each class, all inherited field must be mapped included inherited field. This means that in a class all inherited fields must be mapped into the tables of the current class. (#remappedInheritedFields) - The second mapping is filtered. All classes are mapped into the same tables. The table name is defined on the parent class. The strategy of the children classes is 'superclass-table'. To distinguish classes, a discriminator is required. (#discriminator) - The third mapping is vertical.All classes have its own table containing only fields of the class (not the inherited fields). Each table of devrived classes must defines a join to its parent (#join). In a vertical mapping it is possible and advised to use a discriminator similary than the filtered mapping. The strategy of the children is 'new-table'.

Author:
S.Chassande-Barrioz
See Also:
Serialized Form

Field Summary
 SpeedoClass clazz
          Is speedo meta object representing the class with inheritance.
 SpeedoDiscriminator discriminator
          In case of filtered of vertical mapping, a discriminator permits to distinguish the classes of persistent instances.
 java.util.Map discriminatorValues
          In case of there is discriminator, this fields defines the values of the discriminator parts.
 SpeedoJoin join
          Is the meta object representing the join to herited table in case of vertical mapping.
 java.util.Map remappedInheritedFields
          is the list of field inherited (SpeedoInheritedField) from ancestors.
static java.lang.String SPEEDO_DEFAULT_DISCRIMINENT_VALUE
           
 int strategy
          Is the inheritance strategy.
static int STRATEGY_NEW_TABLE
           
static int STRATEGY_SUBCLASS_TABLE
           
static int STRATEGY_SUPERCLASS_TABLE
           
static int STRATEGY_UNKOWN
           
 java.lang.String superClassName
          Super class name.
 
Fields inherited from class org.objectweb.speedo.metadata.SpeedoElement
jdoExtension, personality
 
Constructor Summary
SpeedoInheritance()
           
SpeedoInheritance(SpeedoClass moClass)
           
 
Method Summary
 void add(SpeedoInheritedField sif)
          Adds a SpeedoInheritedField for defining the mapping of an inherited field.
 boolean isFilteredMapping()
           
 boolean isHorizontalMapping()
           
 boolean isVerticalMapping()
           
 SpeedoInheritedField newSpeedoInheritedField(SpeedoField sf)
           
 SpeedoInheritedField newSpeedoInheritedField(java.lang.String fieldName)
           
static int parseStrategy(java.lang.String strategyName)
           
static java.lang.String strategy2str(int s)
           
 
Methods inherited from class org.objectweb.speedo.metadata.SpeedoElement
addExtension, addInArray, getExtension, getExtensionByKey, getExtensionValueByKey, indexOfInArray, removeInArray, setValueInArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STRATEGY_UNKOWN

public static final int STRATEGY_UNKOWN
See Also:
Constant Field Values

STRATEGY_NEW_TABLE

public static final int STRATEGY_NEW_TABLE
See Also:
Constant Field Values

STRATEGY_SUPERCLASS_TABLE

public static final int STRATEGY_SUPERCLASS_TABLE
See Also:
Constant Field Values

STRATEGY_SUBCLASS_TABLE

public static final int STRATEGY_SUBCLASS_TABLE
See Also:
Constant Field Values

strategy

public int strategy
Is the inheritance strategy. It must be defined at initialisation time.

See Also:
STRATEGY_NEW_TABLE, STRATEGY_SUBCLASS_TABLE, #see #STRATEGY_UNKOWN

clazz

public SpeedoClass clazz
Is speedo meta object representing the class with inheritance. It is not the parent class but the class which has a parent. It must be defined at initialisation time. It must be not null.


superClassName

public java.lang.String superClassName
Super class name.


join

public SpeedoJoin join
Is the meta object representing the join to herited table in case of vertical mapping. It can be null if the mapping is not 'vertical'.


remappedInheritedFields

public java.util.Map remappedInheritedFields
is the list of field inherited (SpeedoInheritedField) from ancestors. The mapping of these fields are redefined. Typical case whith inherited fields correspond to horizontal mapping of the inheritance (one table per class). key is the field name (could be fully qualified) value is a SpeedoInheritedField


discriminator

public SpeedoDiscriminator discriminator
In case of filtered of vertical mapping, a discriminator permits to distinguish the classes of persistent instances. This field can be null if there is no discriminator (horizontal mapping case for instance).


SPEEDO_DEFAULT_DISCRIMINENT_VALUE

public static final java.lang.String SPEEDO_DEFAULT_DISCRIMINENT_VALUE
See Also:
Constant Field Values

discriminatorValues

public java.util.Map discriminatorValues
In case of there is discriminator, this fields defines the values of the discriminator parts. key = discriminator part description (SpeedoField or SpeedoNoFieldColumn) value = the value of the discriminator part for the current class;

See Also:
SpeedoDiscriminator, SpeedoDiscriminator.elements
Constructor Detail

SpeedoInheritance

public SpeedoInheritance()

SpeedoInheritance

public SpeedoInheritance(SpeedoClass moClass)
Method Detail

strategy2str

public static final java.lang.String strategy2str(int s)

parseStrategy

public static final int parseStrategy(java.lang.String strategyName)

add

public void add(SpeedoInheritedField sif)
Adds a SpeedoInheritedField for defining the mapping of an inherited field.

Parameters:
sif - is the field to add

newSpeedoInheritedField

public SpeedoInheritedField newSpeedoInheritedField(java.lang.String fieldName)
                                             throws SpeedoRuntimeException
Parameters:
fieldName - is the
Returns:
a new SpeedoInheritedField corresponding to an existing persistent and inherited field.
Throws:
SpeedoRuntimeException - if the field has not been found or if the field belong the current class (#clazz).

newSpeedoInheritedField

public SpeedoInheritedField newSpeedoInheritedField(SpeedoField sf)
                                             throws SpeedoRuntimeException
Throws:
SpeedoRuntimeException

isHorizontalMapping

public boolean isHorizontalMapping()

isVerticalMapping

public boolean isVerticalMapping()

isFilteredMapping

public boolean isFilteredMapping()