Class RoutingTarget

java.lang.Object
org.springframework.modulith.events.RoutingTarget

public class RoutingTarget extends Object
A String-based routing target that supports a :: delimiter to separate the sole target from an additional key. The key itself could be of any format and might be subject for deeper inspection downstream.
Since:
1.1
Author:
Oliver Drotbohm
  • Method Details

    • parse

      Creates a new RoutingTarget.ParsedRoutingTarget by parsing the given source.
      Parameters:
      source - must not be null.
      Returns:
      will never be null.
    • forTarget

      public static RoutingTarget.RoutingTargetBuilder forTarget(String target)
      Creates a new RoutingTarget.RoutingTargetBuilder for the given target.
      Parameters:
      target - must not be null or empty.
      Returns:
      will never be null.
    • getTarget

      public String getTarget()
      Returns the routing target.
      Returns:
      will never be null.
    • getKey

      public @Nullable String getKey()
      Returns the routing key.
      Returns:
      can be null.
    • hasKeyExpression

      public boolean hasKeyExpression()
      Returns whether the routing key is a SpEL expression.
      Returns:
      whether the routing key is a SpEL expression.
    • hasExpression

      public boolean hasExpression()
      Returns whether either the target or key is using a SpEL expression.
      Returns:
      whether the routing key is a SpEL expression.
      Since:
      1.3
    • withTarget

      RoutingTarget withTarget(String target)
    • withKey

      RoutingTarget withKey(@Nullable String key)
      Creates a new RoutingTarget with the same target but the given routing key.
      Parameters:
      key - can be null.
      Returns:
      will never be null.
    • verify

      RoutingTarget verify()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object