Record Class Destination

java.lang.Object
java.lang.Record
com.iantapply.relay.api.Destination
Record Components:
kind - destination category
nodeId - target node identifier for Destination.Kind.NODE, otherwise null

public record Destination(Destination.Kind kind, String nodeId) extends Record
Selects the Relay nodes that should receive a message.
  • Constructor Details

    • Destination

      public Destination(Destination.Kind kind, String nodeId)
      Validates a destination's category and optional node identifier.
      Parameters:
      kind - destination category
      nodeId - target node identifier for node destinations
  • Method Details

    • broadcast

      public static Destination broadcast()
      Creates a destination containing every Relay node.
      Returns:
      broadcast destination
    • paperServers

      public static Destination paperServers()
      Creates a destination containing every Paper server.
      Returns:
      Paper destination
    • velocityProxies

      public static Destination velocityProxies()
      Creates a destination containing every Velocity proxy.
      Returns:
      Velocity destination
    • node

      public static Destination node(String id)
      Creates a destination for one Relay node.
      Parameters:
      id - node identifier
      Returns:
      node destination
      Throws:
      IllegalArgumentException - if the identifier is invalid
    • wireName

      public String wireName()
      Returns the stable representation used in Relay envelopes.
      Returns:
      wire destination name
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • kind

      public Destination.Kind kind()
      Returns the value of the kind record component.
      Returns:
      the value of the kind record component
    • nodeId

      public String nodeId()
      Returns the value of the nodeId record component.
      Returns:
      the value of the nodeId record component