Record Class BCServerList

java.lang.Object
java.lang.Record
de.florianmichael.classic4j.model.betacraft.BCServerList
Record Components:
servers - The servers on the BetaCraft server list.

public record BCServerList(List<BCServerInfo> servers) extends Record
This class represents a list of servers on the BetaCraft server list. It is used to parse the HTML document returned by the BetaCraft server list.
  • Constructor Details

    • BCServerList

      public BCServerList(List<BCServerInfo> servers)
      Creates an instance of a BCServerList record class.
      Parameters:
      servers - the value for the servers record component
  • Method Details

    • get

      public static CompletableFuture<BCServerList> get(HttpClient httpClient, com.google.gson.Gson gson, URI uri, Class<? extends BCServerInfo> infoSpec)
      Sends a request to the BetaCraft server list and returns the response as a BCServerList object.
      Parameters:
      httpClient - The HttpClient to use for the request.
      gson - The Gson instance to use for the request.
      uri - The URI of the request. This is the URI of the BetaCraft server list.
      infoSpec - The class of the server info specification. This is the class that will be used to parse the JSON response.
      Returns:
      A CompletableFuture containing the response.
    • servers

      public List<BCServerInfo> servers()
      Returns the value of the servers record component.
      Returns:
      the value of the servers record component
    • serversOfVersionCategory

      public List<BCServerInfo> serversOfVersionCategory(BCVersionCategory version)
      Returns a list of servers that have the given version category.
      Parameters:
      version - The version category to filter by.
      Returns:
      A list of servers that have the given version category.
    • serversWithOnlineMode

      public List<BCServerInfo> serversWithOnlineMode(boolean on)
      Returns a list of servers that have the given version category.
      Parameters:
      on - Whether the servers should be online mode or not.
      Returns:
      A list of servers that have the given version category.
    • withConnectVersion

      public List<BCServerInfo> withConnectVersion(String v1Version)
      Returns a list of servers that have the given version category.
      Parameters:
      v1Version - The connect version to filter by.
      Returns:
      A list of servers that have the given version category.
    • 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.