Annotation Interface Command


@Retention(RUNTIME) @Target({TYPE,ANNOTATION_TYPE}) public @interface Command
Annotation used to mark an object as a command.

Allows for specifying the business/domain name() of the command, the version() of the command, and the command's routing key. The fields are used to map an annotated-command to a CommandMessage.

Since:
5.0.0
Author:
Steven van Beelen
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The business or domain name of the command.
    The namespace or (bounded) context of the command.
    The property of the command to be used as a routing key when dispatching the command.
    The version of the command.
  • Element Details

    • namespace

      String namespace
      The namespace or (bounded) context of the command.

      Is used to define the QualifiedName.namespace() of a fully qualified name.

      Defaults to the package name of the annotated class.

      Returns:
      The namespace or (bounded) context of the command.
      Default:
      ""
    • name

      String name
      The business or domain name of the command.

      Is used to define the QualifiedName.localName() of a fully qualified name.

      Defaults to the simple name of the annotated class. Note that when a nested class is annotated, the simple name does not include the names of the enclosing classes.

      Returns:
      The business or domain name of the command.
      Default:
      ""
    • version

      String version
      The version of the command.

      Will typically be mapped to the MessageType.version(). Defaults to MessageType.DEFAULT_VERSION.

      Returns:
      The version of the command.
      Default:
      "0.0.1"
    • routingKey

      String routingKey
      The property of the command to be used as a routing key when dispatching the command.

      The result of invoking the method referring to the given property will be set as the CommandMessage.routingKey().

      Returns:
      The property of the command to use as the routing key.
      Default:
      ""