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.@Nullable TResolves the underlying URI into a full aggregate, potentially applying the configured identifier extractor.@Nullable IDResolves the underlying URI into an aggregate identifier, potentially applying the registered identifier extractor.default TResolves the underlying URI into a full aggregate, potentially applying the configured identifier extractor.default IDResolves the underlying URI into an aggregate identifier, potentially applying the registered identifier extractor.withIdSource(Function<UriComponents, Object> extractor) Creates a newAggregateReferenceresolving the identifier source value from the givenUriComponents.
-
Method Details
-
getUri
-
withIdSource
Creates a newAggregateReferenceresolving the identifier source value from the givenUriComponents.- Parameters:
extractor- must not be null.- Returns:
- will never be null.
-
resolveAggregate
@Nullable T resolveAggregate()Resolves the underlying URI into a full aggregate, potentially applying the configured identifier extractor.- Returns:
- can be null.
- See Also:
-
resolveId
@Nullable ID 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.
-