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 anAssociation
pointing to the givenIdentifier
.default boolean
default boolean
Returns whether the currentAssociation
points to the givenAggregateRoot
.default boolean
pointsToSameAggregateAs
(Association<?, ID> other) Returns whether the currentAssociation
points to the sameAggregateRoot
as 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 concreteAggregateRoot
type.ID
- the concreteIdentifier
type.- Parameters:
aggregate
- must not be null.- Returns:
- an
Association
pointing to theIdentifier
of 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 anAssociation
pointing to the givenIdentifier
.- Type Parameters:
T
- the concreteAggregateRoot
type.ID
- the concreteIdentifier
type.- Parameters:
identifier
- must not be null.- Returns:
- an
Association
pointing to the givenIdentifier
, will never be null. - Since:
- 1.2
-
pointsToSameAggregateAs
Returns whether the currentAssociation
points to the sameAggregateRoot
as the given one. Unlikeinvalid reference
#equals(Object)
invalid reference
#hashCode()
Association
itself, this only compares the targetIdentifier
instances.- Parameters:
other
- must not be null.- Returns:
- whether the current
Association
points to the sameAggregateRoot
as the given one. - Since:
- 1.2
-
pointsTo
Returns whether the currentAssociation
points to theAggregateRoot
with the givenIdentifier
. Unlikeinvalid reference
#equals(Object)
invalid reference
#hashCode()
Association
itself, this only compares the targetIdentifier
instances.- Parameters:
identifier
-- Returns:
- whether the current
Association
points to theAggregateRoot
with the givenIdentifier
. - Since:
- 1.4
-
pointsTo
Returns whether the currentAssociation
points to the givenAggregateRoot
. Unlikeinvalid reference
#equals(Object)
invalid reference
#hashCode()
Association
itself, this only compares the targetIdentifier
instances.- Parameters:
aggregate
- must not be null.- Returns:
- whether the current
Association
points to the givenAggregateRoot
. - Since:
- 1.4
-