Record Class NodeEndpoint

java.lang.Object
java.lang.Record
com.loomcache.client.NodeEndpoint
Record Components:
nodeId - unique identifier for the node (host:port format, must not be null)
address - hostname or IP address of the node (must not be null)
port - port number of the node
weight - relative weight for load balancing (higher = more traffic, default 1)
healthy - whether the node is currently considered healthy

public record NodeEndpoint(String nodeId, String address, int port, int weight, boolean healthy) extends Record
Record representing a cache node endpoint with health and weight information.
  • Constructor Summary

    Constructors
    Constructor
    Description
    NodeEndpoint(String nodeId, String address, int port, int weight, boolean healthy)
    Creates an instance of a NodeEndpoint record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the address record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    Returns the value of the healthy record component.
    Returns the value of the nodeId record component.
    of(String nodeId, String address, int port)
    Create a NodeEndpoint with default weight of 1.
    of(String nodeId, String address, int port, int weight)
    Create a NodeEndpoint with specified weight.
    of(String nodeId, String address, int port, int weight, boolean healthy)
    Create a NodeEndpoint with health status.
    int
    Returns the value of the port record component.
    Returns a string representation of this record class.
    int
    Returns the value of the weight record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • NodeEndpoint

      public NodeEndpoint(String nodeId, String address, int port, int weight, boolean healthy)
      Creates an instance of a NodeEndpoint record class.
      Parameters:
      nodeId - the value for the nodeId record component
      address - the value for the address record component
      port - the value for the port record component
      weight - the value for the weight record component
      healthy - the value for the healthy record component
  • Method Details

    • of

      public static NodeEndpoint of(String nodeId, String address, int port)
      Create a NodeEndpoint with default weight of 1.
    • of

      public static NodeEndpoint of(String nodeId, String address, int port, int weight)
      Create a NodeEndpoint with specified weight.
    • of

      public static NodeEndpoint of(String nodeId, String address, int port, int weight, boolean healthy)
      Create a NodeEndpoint with health status.
    • toString

      public 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • nodeId

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

      public String address()
      Returns the value of the address record component.
      Returns:
      the value of the address record component
    • port

      public int port()
      Returns the value of the port record component.
      Returns:
      the value of the port record component
    • weight

      public int weight()
      Returns the value of the weight record component.
      Returns:
      the value of the weight record component
    • healthy

      public boolean healthy()
      Returns the value of the healthy record component.
      Returns:
      the value of the healthy record component