Interface AggregateModel<T>

Type Parameters:
T - The type of the aggregate root
All Superinterfaces:
EntityModel<T>

public interface AggregateModel<T> extends EntityModel<T>
Specialized EntityModel that describes the capabilities and properties of an aggregate root of type T.
  • Method Details

    • type

      String type()
      Get the String representation of the modeled aggregate's type. This defaults to the simple name of the aggregate's type.
      Returns:
      The type of the aggregate
    • getVersion

      Long getVersion(T target)
      Get the current version number of the given aggregate. For event sourced aggregates this is identical to the sequence number of the last applied event.
      Parameters:
      target - The target aggregate root instance
      Returns:
      The current version of the aggregate
    • type

      default Optional<Class<?>> type(String declaredType)
      Gets the aggregate class based on given declaredType.
      Parameters:
      declaredType - the declared type of aggregate represented by String
      Returns:
      the concrete aggregate class based on declaredType, if exists
    • declaredType

      default Optional<String> declaredType(Class<?> type)
      Gets the declared aggregate type based on given class type.
      Parameters:
      type - the type of the aggregate
      Returns:
      the declared aggregate type represented by String, if exists
    • types

      default Stream<Class<?>> types()
      Gets all types (concrete aggregate classes) of this aggregate.
      Returns:
      all types (concrete aggregate classes) of this aggregate