Package io.inversion
Class Relationship
- java.lang.Object
-
- io.inversion.Relationship
-
- All Implemented Interfaces:
java.io.Serializable
public final class Relationship extends java.lang.Object implements java.io.Serializable- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Collectioncollectionprotected booleanexcludeprotected IndexfkIndex1protected IndexfkIndex2protected java.lang.Stringnamestatic java.lang.StringREL_MANY_TO_MANYstatic java.lang.StringREL_MANY_TO_ONEstatic java.lang.StringREL_ONE_TO_MANYstatic java.lang.StringREL_ONE_TO_ONE_CHILDstatic java.lang.StringREL_ONE_TO_ONE_PARENTprotected Collectionrelatedprotected java.lang.Stringtype
-
Constructor Summary
Constructors Constructor Description Relationship()Relationship(java.lang.String name, java.lang.String type, Collection collection, Collection related, Index fkIndex1, Index fkIndex2)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.lang.Object>buildForeignKeyFromPrimaryKey(java.util.Map<java.lang.String,java.lang.Object> primaryKey)java.util.Map<java.lang.String,java.lang.Object>buildPrimaryKeyFromForeignKey(java.util.Map<java.lang.String,java.lang.Object> foreignKey)booleanequals(java.lang.Object obj)CollectiongetCollection()PropertygetFk1Col1()PropertygetFk2Col1()IndexgetFkIndex1()IndexgetFkIndex2()RelationshipgetInverse()java.lang.StringgetName()CollectiongetPrimaryKeyTable1()CollectiongetRelated()java.lang.StringgetType()booleanisExclude()booleanisManyToMany()booleanisManyToOne()booleanisOneToMany()booleanisOneToOneChild()booleanisOneToOneParent()java.lang.StringtoString()RelationshipwithCollection(Collection collection)RelationshipwithExclude(boolean exclude)RelationshipwithFkIndex1(Index fkIndex1)RelationshipwithFkIndex2(Index fkIndex2)RelationshipwithName(java.lang.String name)RelationshipwithRelated(Collection related)RelationshipwithType(java.lang.String type)
-
-
-
Field Detail
-
REL_ONE_TO_ONE_PARENT
public static final java.lang.String REL_ONE_TO_ONE_PARENT
- See Also:
- Constant Field Values
-
REL_ONE_TO_ONE_CHILD
public static final java.lang.String REL_ONE_TO_ONE_CHILD
- See Also:
- Constant Field Values
-
REL_MANY_TO_ONE
public static final java.lang.String REL_MANY_TO_ONE
- See Also:
- Constant Field Values
-
REL_ONE_TO_MANY
public static final java.lang.String REL_ONE_TO_MANY
- See Also:
- Constant Field Values
-
REL_MANY_TO_MANY
public static final java.lang.String REL_MANY_TO_MANY
- See Also:
- Constant Field Values
-
name
protected java.lang.String name
-
type
protected java.lang.String type
-
fkIndex1
protected Index fkIndex1
-
fkIndex2
protected Index fkIndex2
-
collection
protected Collection collection
-
related
protected Collection related
-
exclude
protected boolean exclude
-
-
Constructor Detail
-
Relationship
public Relationship()
-
Relationship
public Relationship(java.lang.String name, java.lang.String type, Collection collection, Collection related, Index fkIndex1, Index fkIndex2)
-
-
Method Detail
-
isExclude
public boolean isExclude()
-
withExclude
public Relationship withExclude(boolean exclude)
-
getCollection
public Collection getCollection()
- Returns:
- the collection
-
withCollection
public Relationship withCollection(Collection collection)
-
getRelated
public Collection getRelated()
- Returns:
- the related
-
getInverse
public Relationship getInverse()
-
withRelated
public Relationship withRelated(Collection related)
- Parameters:
related- the related to set- Returns:
- this
-
isManyToMany
public boolean isManyToMany()
-
isOneToMany
public boolean isOneToMany()
-
isManyToOne
public boolean isManyToOne()
-
isOneToOneParent
public boolean isOneToOneParent()
-
isOneToOneChild
public boolean isOneToOneChild()
-
getName
public java.lang.String getName()
- Returns:
- the name
-
withName
public Relationship withName(java.lang.String name)
- Parameters:
name- the name to set- Returns:
- this
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getType
public java.lang.String getType()
- Returns:
- the type
-
withType
public Relationship withType(java.lang.String type)
- Parameters:
type- the type to set- Returns:
- this
-
getFkIndex1
public Index getFkIndex1()
-
withFkIndex1
public Relationship withFkIndex1(Index fkIndex1)
-
getFkIndex2
public Index getFkIndex2()
-
withFkIndex2
public Relationship withFkIndex2(Index fkIndex2)
-
getPrimaryKeyTable1
public Collection getPrimaryKeyTable1()
-
getFk1Col1
public Property getFk1Col1()
- Returns:
- the fkCol1
-
getFk2Col1
public Property getFk2Col1()
- Returns:
- the fkCol2
-
buildPrimaryKeyFromForeignKey
public java.util.Map<java.lang.String,java.lang.Object> buildPrimaryKeyFromForeignKey(java.util.Map<java.lang.String,java.lang.Object> foreignKey)
-
buildForeignKeyFromPrimaryKey
public java.util.Map<java.lang.String,java.lang.Object> buildForeignKeyFromPrimaryKey(java.util.Map<java.lang.String,java.lang.Object> primaryKey)
-
-