@ -31,14 +31,21 @@ import org.springframework.util.Assert;
@@ -31,14 +31,21 @@ import org.springframework.util.Assert;
* /
public interface AggregateReference < T , ID > {
/ * *
* Creates an { @link AggregateReference } that refers to the target aggregate root with the given id .
*
* @param id aggregate identifier . Must not be { @literal null } , can be a simple value .
* @return
* @param < T > target aggregate type .
* @param < ID > target aggregate identifier type .
* /
static < T , ID > AggregateReference < T , ID > to ( ID id ) {
return new IdOnlyAggregateReference < > ( id ) ;
}
/ * *
* @return the id of the referenced aggregate . May be { @code null } .
* @return the id of the referenced aggregate .
* /
@Nullable
ID getId ( ) ;
/ * *
@ -55,7 +62,6 @@ public interface AggregateReference<T, ID> {
@@ -55,7 +62,6 @@ public interface AggregateReference<T, ID> {
public IdOnlyAggregateReference ( ID id ) {
Assert . notNull ( id , "Id must not be null" ) ;
this . id = id ;
}
@ -82,7 +88,6 @@ public interface AggregateReference<T, ID> {
@@ -82,7 +88,6 @@ public interface AggregateReference<T, ID> {
@Override
public String toString ( ) {
return "IdOnlyAggregateReference{" + "id=" + id + '}' ;
}
}