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 an
AggregateRoot.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic <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 booleandefault booleanReturns 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 Details
-
forAggregate
static <T extends AggregateRoot<T,ID>, Association<T,ID extends Identifier> 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>, Association<T,ID extends Identifier> 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
Returns whether the currentAssociationpoints to the sameAggregateRootas the given one. Unlikeandinvalid reference
#equals(Object)that also check for type equality of theinvalid reference
#hashCode()Associationitself, 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
Returns whether the currentAssociationpoints to theAggregateRootwith the givenIdentifier. Unlikeandinvalid reference
#equals(Object)that also check for type equality of theinvalid reference
#hashCode()Associationitself, this only compares the targetIdentifierinstances.- Parameters:
identifier-- Returns:
- whether the current
Associationpoints to theAggregateRootwith the givenIdentifier. - Since:
- 1.4
-
pointsTo
Returns whether the currentAssociationpoints to the givenAggregateRoot. Unlikeandinvalid reference
#equals(Object)that also check for type equality of theinvalid reference
#hashCode()Associationitself, this only compares the targetIdentifierinstances.- Parameters:
aggregate- must not be null.- Returns:
- whether the current
Associationpoints to the givenAggregateRoot. - Since:
- 1.4
-