Package org.jmolecules.ddd.types
Class SimpleAssociation<T extends AggregateRoot<T,ID>,ID extends Identifier>
- java.lang.Object
-
- org.jmolecules.ddd.types.SimpleAssociation<T,ID>
-
- All Implemented Interfaces:
Association<T,ID>,Identifiable<ID>
class SimpleAssociation<T extends AggregateRoot<T,ID>,ID extends Identifier> extends java.lang.Object implements Association<T,ID>
Simple implementation ofAssociationto effectively only defineequals(Object)andhashCode()onAssociation's static factory methods.- Since:
- 1.2
- See Also:
Association.forId(Identifier),Association.forAggregate(AggregateRoot)
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.function.Supplier<ID>identifier
-
Constructor Summary
Constructors Constructor Description SimpleAssociation(java.util.function.Supplier<ID> identifier)Creates a newSimpleAssociationfor the given identifier.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)IDgetId()Returns the identifier.inthashCode()java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jmolecules.ddd.types.Association
pointsTo, pointsTo, pointsToSameAggregateAs
-
-
-
-
Field Detail
-
identifier
private final java.util.function.Supplier<ID extends Identifier> identifier
-
-
Constructor Detail
-
SimpleAssociation
SimpleAssociation(java.util.function.Supplier<ID> identifier)
Creates a newSimpleAssociationfor the given identifier.- Parameters:
identifier- must not be null.
-
-
Method Detail
-
getId
public ID getId()
Description copied from interface:IdentifiableReturns the identifier.- Specified by:
getIdin interfaceIdentifiable<T extends AggregateRoot<T,ID>>- Returns:
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-