Interface AggregateReference<T,ID>
- All Known Subinterfaces:
AssociationAggregateReference<T,
ID>
- All Known Implementing Classes:
ResolvingAggregateReference
public interface AggregateReference<T,ID>
Represents a reference to an aggregate backed by a URI. It can be resolved into an aggregate identifier or the
aggregate instance itself.
- Since:
- 4.1
- Author:
- Oliver Drotbohm
-
Method Summary
Modifier and TypeMethodDescriptiongetUri()
Returns the sourceURI
.Resolves the underlying URI into a full aggregate, potentially applying the configured identifier extractor.Resolves the underlying URI into an aggregate identifier, potentially applying the registered identifier extractor.default T
Resolves the underlying URI into a full aggregate, potentially applying the configured identifier extractor.default ID
Resolves the underlying URI into an aggregate identifier, potentially applying the registered identifier extractor.withIdSource
(Function<UriComponents, Object> extractor) Creates a newAggregateReference
resolving the identifier source value from the givenUriComponents
.
-
Method Details
-
getUri
URI getUri()Returns the sourceURI
.- Returns:
- will never be null.
-
withIdSource
Creates a newAggregateReference
resolving the identifier source value from the givenUriComponents
.- Parameters:
extractor
- must not be null.- Returns:
- will never be null.
-
resolveAggregate
Resolves the underlying URI into a full aggregate, potentially applying the configured identifier extractor.- Returns:
- can be null.
- See Also:
-
resolveId
Resolves the underlying URI into an aggregate identifier, potentially applying the registered identifier extractor.- Returns:
- can be null.
- See Also:
-
resolveRequiredAggregate
Resolves the underlying URI into a full aggregate, potentially applying the configured identifier extractor.- Returns:
- will never be null.
- Throws:
IllegalStateException
- in case the value resolved is null.
-
resolveRequiredId
Resolves the underlying URI into an aggregate identifier, potentially applying the registered identifier extractor.- Returns:
- will never be null.
- Throws:
IllegalStateException
- in case the value resolved is null.
-