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 Type
    Method
    Description
    Returns the source URI.
    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.
    Creates a new AggregateReference resolving the identifier source value from the given UriComponents.
  • Method Details

    • getUri

      URI getUri()
      Returns the source URI.
      Returns:
      will never be null.
    • withIdSource

      AggregateReference<T,ID> withIdSource(Function<UriComponents,Object> extractor)
      Creates a new AggregateReference resolving the identifier source value from the given UriComponents.
      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

      default T 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

      default ID 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.