org.objectweb.speedo.metadata
Class SpeedoDiscriminator

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

public class SpeedoDiscriminator
extends SpeedoElement

In case of filtered of vertical mapping, a discriminator permits to distinguish the classes of persistent instances. This class defines a disciminator used for the inheritance mapping. A discriminator is characterized by its strategy and the columns or field composing the discriminator.

Author:
S.Chassande-Barrioz
See Also:
SpeedoInheritance, SpeedoField, SpeedoColumn, Serialized Form

Field Summary
 java.util.List elements
          If discriminatorStrategy equals to #STRATEGY_NONE this field has no sense.
 java.lang.String expression
           
 int strategy
          In case of filtered of vertical mapping, a discriminator permits to distinguish the classes of persistent instances.
static int STRATEGY_CLASS_NAME
          This strategy of discriminator is a specialization of the STRATEGY_MAP_VALUE strategy.
static int STRATEGY_MAP_VALUE
          strategy of discriminator based on couples (class , value).
static int STRATEGY_NONE
          strategy without discriminator
static int STRATEGY_UNKNOWN
           
 
Fields inherited from class org.objectweb.speedo.metadata.SpeedoElement
jdoExtension, personality
 
Constructor Summary
SpeedoDiscriminator()
           
 
Method Summary
 boolean basedOnColumnsOnly()
           
 boolean basedOnFieldsAndColumns()
           
 boolean basedOnFieldsOnly()
           
 boolean hasDiscriminator()
           
static int parseStrategy(java.lang.String strategyName)
          Parses a string representation of a strategy.
 void setDiscriminatorValue(java.lang.Object value, SpeedoInheritance si, SpeedoElement elem)
           
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_UNKNOWN

public static final int STRATEGY_UNKNOWN
See Also:
Constant Field Values

STRATEGY_NONE

public static final int STRATEGY_NONE
strategy without discriminator

See Also:
Constant Field Values

STRATEGY_MAP_VALUE

public static final int STRATEGY_MAP_VALUE
strategy of discriminator based on couples (class , value). To each value corresponds only one value and to each concrete class corresponds an unique value. Each classes has to defines its value.

See Also:
Constant Field Values

STRATEGY_CLASS_NAME

public static final int STRATEGY_CLASS_NAME
This strategy of discriminator is a specialization of the STRATEGY_MAP_VALUE strategy. With this strategy the value associated to each persistent and concrete class is the class name.

See Also:
Constant Field Values

strategy

public int strategy
In case of filtered of vertical mapping, a discriminator permits to distinguish the classes of persistent instances. This field defines the strategy of the discriminator. The default value is #STRATEGY_NONE, corresponding to the case of there is no discriminator. Possible values are defined as constant in this class:

See Also:
STRATEGY_NONE, STRATEGY_MAP_VALUE, STRATEGY_CLASS_NAME

elements

public java.util.List elements
If discriminatorStrategy equals to #STRATEGY_NONE this field has no sense. Otherwise this field defines the columns of fields composing the discriminator. Elements of this list can be SpeedoField or SpeedoNoFieldColumn instances.

See Also:
SpeedoColumn, SpeedoField, SpeedoNoFieldColumn, SpeedoInheritance.discriminator, SpeedoInheritance.discriminatorValues

expression

public java.lang.String expression
Constructor Detail

SpeedoDiscriminator

public SpeedoDiscriminator()
Method Detail

strategy2str

public static final java.lang.String strategy2str(int s)
Parameters:
s - is a strategy
Returns:
string representation of the strategy. If the strategy is not recongnized a null value is returned.

parseStrategy

public static final int parseStrategy(java.lang.String strategyName)
Parses a string representation of a strategy.

Parameters:
strategyName - is a representation of a strategy
Returns:
the strategy corrresponding to the strategy name. If the strategy is not recongnized STRATEGY_UNKNOWN is returned.

hasDiscriminator

public boolean hasDiscriminator()
Returns:
a boolean value indicating if the strategy is not NONE and if there is elements composing the discriminator.

basedOnFieldsOnly

public boolean basedOnFieldsOnly()
Returns:
boolean value indicating if there is a discriminator composed of fields.

basedOnColumnsOnly

public boolean basedOnColumnsOnly()
Returns:
boolean value indicating if there is a discriminator composed of columns only.

basedOnFieldsAndColumns

public boolean basedOnFieldsAndColumns()

setDiscriminatorValue

public void setDiscriminatorValue(java.lang.Object value,
                                  SpeedoInheritance si,
                                  SpeedoElement elem)