public class RelationshipElement extends PersistenceFieldElement
| Modifier and Type | Class and Description |
|---|---|
static interface |
RelationshipElement.Impl
Pluggable implementation of the storage of relationship element
properties.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
AGGREGATE_ACTION
Constant representing aggregate action.
|
static int |
CASCADE_ACTION
Constant representing cascade action.
|
static int |
NONE_ACTION
Constant representing no action.
|
static int |
NULLIFY_ACTION
Constant representing nullify action.
|
static int |
RESTRICT_ACTION
Constant representing restrict action.
|
DERIVED, PERSISTENT, TRANSIENTPROP_CARDINALITY, PROP_COLLECTION_CLASS, PROP_DELETE_ACTION, PROP_ELEMENT_CLASS, PROP_FIELDS, PROP_GROUPS, PROP_IDENTITY, PROP_INVERSE_FIELD, PROP_KEY_CLASS, PROP_KEY_FIELD, PROP_MODIFIED, PROP_NAME, PROP_PERSISTENCE, PROP_PREFETCH, PROP_SENSITIVITY, PROP_UPDATE_ACTION| Constructor and Description |
|---|
RelationshipElement()
Create new RelationshipElement with no implementation.
|
RelationshipElement(RelationshipElement.Impl impl,
PersistenceClassElement declaringClass)
Create new RelationshipElement with the provided implementation.
|
| Modifier and Type | Method and Description |
|---|---|
void |
changeInverseRelationship(RelationshipElement inverseRelationship)
Changes the inverse relationship element for this relationship element.
|
String |
getCollectionClass()
Get the collection class (for example Set, List, Vector, etc.)
for this relationship element.
|
int |
getDeleteAction()
Get the delete action for this relationship element.
|
String |
getElementClass()
Get the element class for this relationship element.
|
RelationshipElement |
getInverseRelationship(Model model)
Get the inverse relationship element for this relationship element.
|
String |
getInverseRelationshipName()
Get the relative name of the inverse relationship field for this
relationship element.
|
int |
getLowerBound()
Get the lower cardinality bound for this relationship element.
|
int |
getUpdateAction()
Get the update action for this relationship element.
|
int |
getUpperBound()
Get the upper cardinality bound for this relationship element.
|
boolean |
isPrefetch()
Determines whether this relationship element should prefetch or not.
|
void |
setCollectionClass(String collectionClass)
Set the collection class for this relationship element.
|
void |
setDeleteAction(int action)
Set the delete action for this relationship element.
|
void |
setElementClass(String elementClass)
Set the element class for this relationship element.
|
void |
setInverseRelationship(RelationshipElement inverseRelationship,
Model model)
Set the inverse relationship element for this relationship element.
|
void |
setLowerBound(int lowerBound)
Set the lower cardinality bound for this relationship element.
|
void |
setPrefetch(boolean flag)
Set whether this relationship element should prefetch or not.
|
void |
setUpdateAction(int action)
Set the update action for this relationship element.
|
void |
setUpperBound(int upperBound)
Set the upper cardinality bound for this relationship element.
|
getConcurrencyGroups, getFieldNumber, getPersistenceType, isKey, isReadSensitive, isWriteSensitive, setKey, setPersistenceType, setReadSensitive, setWriteSensitiveequals, getDeclaringClass, hashCode, setDeclaringClassaddPropertyChangeListener, addVetoableChangeListener, compareTo, getImpl, getMessages, getName, removePropertyChangeListener, removeVetoableChangeListener, setImpl, setName, toStringpublic static final int NONE_ACTION
public static final int NULLIFY_ACTION
public static final int RESTRICT_ACTION
public static final int CASCADE_ACTION
public static final int AGGREGATE_ACTION
public RelationshipElement()
public RelationshipElement(RelationshipElement.Impl impl, PersistenceClassElement declaringClass)
impl - the implementation to usedeclaringClass - the class to attach topublic int getUpdateAction()
NONE_ACTION,
NULLIFY_ACTION, RESTRICT_ACTION,
CASCADE_ACTION, or AGGREGATE_ACTIONpublic void setUpdateAction(int action)
throws ModelException
action - - an integer indicating the update action, one of:
NONE_ACTION, NULLIFY_ACTION, RESTRICT_ACTION,
CASCADE_ACTION, or AGGREGATE_ACTIONModelException - if impossiblepublic int getDeleteAction()
NONE_ACTION,
NULLIFY_ACTION, RESTRICT_ACTION,
CASCADE_ACTION, or AGGREGATE_ACTIONpublic void setDeleteAction(int action)
throws ModelException
action - - an integer indicating the delete action, one of:
NONE_ACTION, NULLIFY_ACTION, RESTRICT_ACTION,
CASCADE_ACTION, or AGGREGATE_ACTIONModelException - if impossiblepublic boolean isPrefetch()
true if the relationship should prefetch,
false otherwisepublic void setPrefetch(boolean flag)
throws ModelException
flag - - if true, the relationship is set to prefetch;
otherwise, it is notModelException - if impossiblepublic int getLowerBound()
public void setLowerBound(int lowerBound)
throws ModelException
lowerBound - - an integer indicating the lower cardinality boundModelException - if impossiblepublic int getUpperBound()
Integer.MAX_VALUE for npublic void setUpperBound(int upperBound)
throws ModelException
upperBound - - an integer indicating the upper cardinality bound
(use Integer.MAX_VALUE for n)ModelException - if impossiblepublic String getCollectionClass()
public void setCollectionClass(String collectionClass) throws ModelException
collectionClass - - a string indicating the type of
collection (for example Set, List, Vector, etc.)ModelException - if impossiblepublic String getElementClass()
wrapperclass.TYPE.toString() to specify them.public void setElementClass(String elementClass) throws ModelException
elementClass - - a string indicating the type of elements in
the collection. If primitive types are supported, you can use
wrapperclass.TYPE.toString() to specify them.ModelException - if impossiblepublic String getInverseRelationshipName()
null. Note that it is possible to have this
method return a value, but because of the combination of related class
and lookup, there may be no corresponding RelationshipElement which can
be found.getInverseRelationship(com.sun.jdo.api.persistence.model.Model)public RelationshipElement getInverseRelationship(Model model)
null. Note that it is also possible for this method to
return null even if getInverseRelationshipName()
returns a value because the corresponding RelationshipElement cannot
be found using the combination of related class and lookup (model).model - the model object to be used to look it upgetInverseRelationshipName()public void setInverseRelationship(RelationshipElement inverseRelationship, Model model) throws ModelException
inverseRelationship - - a relationship element to be used as the
inverse for this relationship element or null if this
relationship element does not participate in a two-way relationship.model - the model object to be used to look up the old inverse so
it can be unsetModelException - if impossiblepublic void changeInverseRelationship(RelationshipElement inverseRelationship) throws ModelException
setInverseRelationship(com.sun.jdo.api.persistence.model.jdo.RelationshipElement, com.sun.jdo.api.persistence.model.Model) and should handle the
vetoable change events, property change events, and setting the internal
variable.inverseRelationship - - a relationship element to be used as the
inverse for this relationship element or null if this
relationship element does not participate in a two-way relationship.ModelException - if impossibleCopyright © 2017–2019 Eclipse Foundation. All rights reserved.