Class AnnotatedHandlerAttributes

java.lang.Object
org.axonframework.messaging.core.annotation.AnnotatedHandlerAttributes
All Implemented Interfaces:
HandlerAttributes

public class AnnotatedHandlerAttributes extends Object implements HandlerAttributes
Container for message handler attributes, constructed through inspecting an AnnotatedElement. It does so by validating all (meta-)annotations of the given element for the presence of the HasHandlerAttributes annotation. Each found (meta-)annotation's attributes will be included.

This implementation can discover several collections of attributes. All attributes are prefixed with the simple name of the annotation (meta-)annotated with HasHandlerAttributes, separated by a dot.

Since:
4.5.0
Author:
Steven van Beelen
  • Constructor Details

    • AnnotatedHandlerAttributes

      public AnnotatedHandlerAttributes(AnnotatedElement annotatedElement)
      Create an AnnotatedHandlerAttributes containing all attributes of annotation (meta-)annotated with HasHandlerAttributes on the given annotatedElement. Each attribute will be stored based on the simple name of the annotation (meta-)annotated with HasHandlerAttributes combined with the attribute name.

      The handler annotation name and attribute name are separated by dots. This leads to a key format of "[handlerType].[attributeName]".

      Parameters:
      annotatedElement - the AnnotatedElement to extract handler attributes for
  • Method Details

    • get

      public <R> R get(String attributeKey)
      Description copied from interface: HandlerAttributes
      Retrieve the attribute for the given attributeKey. Might be null if there is no attribute present for the given key.
      Specified by:
      get in interface HandlerAttributes
      Type Parameters:
      R - the type of attribute to retrieve
      Parameters:
      attributeKey - the attribute key to retrieve an attribute for
      Returns:
      the attribute for the given attributeKey
    • getAll

      public Map<String,Object> getAll()
      Description copied from interface: HandlerAttributes
      Retrieve all attributes stored in this HandlerAttributes object.
      Specified by:
      getAll in interface HandlerAttributes
      Returns:
      all attributes stored in this HandlerAttributes object
    • contains

      public boolean contains(String attributeKey)
      Description copied from interface: HandlerAttributes
      Validates whether the given attributeKey is present in this object.
      Specified by:
      contains in interface HandlerAttributes
      Parameters:
      attributeKey - the attribute key to validate if it is present in this object
      Returns:
      true if there is an attribute for the given attributeKey present, false otherwise
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: HandlerAttributes
      Validate whether zero attributes are present in this object.
      Specified by:
      isEmpty in interface HandlerAttributes
      Returns:
      true if there are no attributes present, false otherwise
    • mergedWith

      public HandlerAttributes mergedWith(HandlerAttributes other)
      Description copied from interface: HandlerAttributes
      Returns a HandlerAttributes, merging the attributes in this instance with the given attributes. If this and other have identical entries, the values from other will take precedence.
      Specified by:
      mergedWith in interface HandlerAttributes
      Parameters:
      other - The HandlerAttributes to group with this instance's attributes.
      Returns:
      A HandlerAttributes combining this instance's attributes and the given other attributes.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object