Class Endpoint

java.lang.Object
com.hedera.hashgraph.sdk.Endpoint
All Implemented Interfaces:
Cloneable

public class Endpoint extends Object implements Cloneable
Utility class used internally by the sdk.
  • Field Details

    • address

      @Nullable byte[] address
    • port

      int port
    • domainName

      String domainName
  • Constructor Details

    • Endpoint

      public Endpoint()
      Constructor.
  • Method Details

    • fromProtobuf

      static Endpoint fromProtobuf(ServiceEndpoint serviceEndpoint)
      Create an endpoint object from a service endpoint protobuf.
      Parameters:
      serviceEndpoint - the service endpoint protobuf
      Returns:
      the endpoint object
    • getAddress

      @Nullable public byte[] getAddress()
      Extract the ipv4 address.
      Returns:
      the ipv4 address
    • setAddress

      public Endpoint setAddress(byte[] address)
      Assign the ipv4 address.
      Parameters:
      address - the desired ipv4 address
      Returns:
      this
    • getPort

      public int getPort()
      Extract the port number.
      Returns:
      the port number
    • setPort

      public Endpoint setPort(int port)
      Assign the desired port number.
      Parameters:
      port - the desired port number
      Returns:
      this
    • getDomainName

      public String getDomainName()
      Extract the domain name.
      Returns:
      the domain name
    • setDomainName

      public Endpoint setDomainName(String domainName)
      Assign the desired domain name.
      Parameters:
      domainName - the desired domain name
      Returns:
      this
    • validateNoIpAndDomain

      public static void validateNoIpAndDomain(Endpoint endpoint)
      Validate that the endpoint does not contain both an IP address and a domain name.
      Parameters:
      endpoint - the endpoint to validate
      Throws:
      IllegalArgumentException - if both ipAddressV4 and domainName are present
    • toProtobuf

      ServiceEndpoint toProtobuf()
      Create the protobuf.
      Returns:
      the protobuf representation
    • toString

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

      public Endpoint clone()
      Overrides:
      clone in class Object