Package org.jmolecules.ddd.types
Interface Association<T extends AggregateRoot<T,ID>,ID extends Identifier>
-
- All Superinterfaces:
Identifiable<ID>
- All Known Implementing Classes:
SimpleAssociation
public interface Association<T extends AggregateRoot<T,ID>,ID extends Identifier> extends Identifiable<ID>
An association to anAggregateRoot.- See Also:
-
-
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description static <T extends AggregateRoot<T,ID>,ID extends Identifier>
Association<T,ID>forAggregate(T aggregate)static <T extends AggregateRoot<T,ID>,ID extends Identifier>
Association<T,ID>forId(ID identifier)Creates anAssociationpointing to the givenIdentifier.default booleanpointsTo(ID identifier)default booleanpointsTo(T aggregate)Returns whether the currentAssociationpoints to the givenAggregateRoot.default booleanpointsToSameAggregateAs(Association<?,ID> other)Returns whether the currentAssociationpoints to the sameAggregateRootas the given one.-
Methods inherited from interface org.jmolecules.ddd.types.Identifiable
getId
-
-
-
-
-
Method Detail
-
forAggregate
static <T extends AggregateRoot<T,ID>,ID extends Identifier> Association<T,ID> forAggregate(T aggregate)
- Type Parameters:
T- the concreteAggregateRoottype.ID- the concreteIdentifiertype.- Parameters:
aggregate- must not be null.- Returns:
- an
Associationpointing to theIdentifierof the givenAggregateRoot, will never be null. - Since:
- 1.2
-
forId
static <T extends AggregateRoot<T,ID>,ID extends Identifier> Association<T,ID> forId(ID identifier)
Creates anAssociationpointing to the givenIdentifier.- Type Parameters:
T- the concreteAggregateRoottype.ID- the concreteIdentifiertype.- Parameters:
identifier- must not be null.- Returns:
- an
Associationpointing to the givenIdentifier, will never be null. - Since:
- 1.2
-
pointsToSameAggregateAs
default boolean pointsToSameAggregateAs(Association<?,ID> other)
Returns whether the currentAssociationpoints to the sameAggregateRootas the given one. Unlike#equals(Object)and#hashCode()that also check for type equality of theAssociationitself, this only compares the targetIdentifierinstances.- Parameters:
other- must not be null.- Returns:
- whether the current
Associationpoints to the sameAggregateRootas the given one. - Since:
- 1.2
-
pointsTo
default boolean pointsTo(ID identifier)
Returns whether the currentAssociationpoints to theAggregateRootwith the givenIdentifier. Unlike#equals(Object)and#hashCode()that also check for type equality of theAssociationitself, this only compares the targetIdentifierinstances.- Parameters:
identifier-- Returns:
- whether the current
Associationpoints to theAggregateRootwith the givenIdentifier. - Since:
- 1.4
-
pointsTo
default boolean pointsTo(T aggregate)
Returns whether the currentAssociationpoints to the givenAggregateRoot. Unlike#equals(Object)and#hashCode()that also check for type equality of theAssociationitself, this only compares the targetIdentifierinstances.- Parameters:
aggregate- must not be null.- Returns:
- whether the current
Associationpoints to the givenAggregateRoot. - Since:
- 1.4
-
-