Package org.apache.cayenne.map
Class Relationship<E extends Entity<E,A,R>,A extends Attribute<E,A,R>,R extends Relationship<E,A,R>>        
java.lang.Object
org.apache.cayenne.map.Relationship<E,A,R>  
- All Implemented Interfaces:
- Serializable,- CayenneMapEntry,- XMLSerializable
- Direct Known Subclasses:
- DbRelationship,- ObjRelationship
public abstract class Relationship<E extends Entity<E,A,R>,A extends Attribute<E,A,R>,R extends Relationship<E,A,R>>        
extends Object
implements CayenneMapEntry, XMLSerializable, Serializable
Defines a relationship between two entities. In a DataMap graph relationships represent
 "arcs" connecting entity "nodes". Relationships are directional, i.e. they have a
 notion of source and target entity. This makes DataMap a "digraph".
- See Also:
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionCreates an unnamed relationship.Relationship(String name) Creates a named relationship.
- 
Method SummaryModifier and TypeMethodDescriptiongetName()Returns the name property of this object.Returns the parent map.abstract Relationship<E,A, R> Returns a "complimentary" relationship going in the opposite direction.Returns relationship source entity.abstract EReturns a target entity of the relationship.Returns the name of a target entity.abstract booleanReturns if relationship is mandatorybooleanbooleanisToMany()Returns a boolean value that determines relationship multiplicity.voidvoidStores the parent map.voidsetRuntime(boolean synthetic) voidsetSourceEntity(E sourceEntity) Sets relationship source entity.voidsetTargetEntityName(String targetEntityName) Sets the name of relationship target entity.voidsetTargetEntityName(Entity<E, A, R> targetEntity) Sets relationship target entity.toString()Overrides Object.toString() to return informative description.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.cayenne.util.XMLSerializableencodeAsXML
- 
Field Details- 
name
- 
sourceEntity
- 
targetEntityName
- 
toManyprotected boolean toMany
- 
runtimeprotected boolean runtimeA flag that specifies whether a Relationship was mapped by the user or added dynamically by Cayenne runtime.- Since:
- 3.0
 
 
- 
- 
Constructor Details- 
Relationshippublic Relationship()Creates an unnamed relationship.
- 
RelationshipCreates a named relationship.
 
- 
- 
Method Details- 
getNameDescription copied from interface:CayenneMapEntryReturns the name property of this object.- Specified by:
- getNamein interface- CayenneMapEntry
- Returns:
- name of this entry.
 
- 
setName
- 
getSourceEntityReturns relationship source entity.
- 
setSourceEntitySets relationship source entity.
- 
getTargetEntityReturns a target entity of the relationship.
- 
setTargetEntityNameSets relationship target entity. Internally callssetTargetEntityName.
- 
getTargetEntityNameReturns the name of a target entity.
- 
setTargetEntityNameSets the name of relationship target entity.
- 
isToManypublic boolean isToMany()Returns a boolean value that determines relationship multiplicity. This defines semantics of the connection between two nodes described by the source and target entities. E.g. to-many relationship between two Persistent object classes means that a source object would have a collection of target objects. This is a read-only property.
- 
getParentDescription copied from interface:CayenneMapEntryReturns the parent map.- Specified by:
- getParentin interface- CayenneMapEntry
 
- 
setParentDescription copied from interface:CayenneMapEntryStores the parent map.- Specified by:
- setParentin interface- CayenneMapEntry
 
- 
toStringOverrides Object.toString() to return informative description.
- 
isRuntimepublic boolean isRuntime()- Since:
- 3.0
 
- 
setRuntimepublic void setRuntime(boolean synthetic) - Since:
- 3.0
 
- 
getReverseRelationshipReturns a "complimentary" relationship going in the opposite direction. Returns null if no such relationship is found.- Since:
- 3.1
 
- 
isMandatorypublic abstract boolean isMandatory()Returns if relationship is mandatory- Since:
- 3.1
 
 
-