Class Ping

java.lang.Object
org.tweetyproject.web.services.Ping

public class Ping extends Object
Represents a simple data structure for handling "ping" messages. Each Ping object has an identifier (id) and content. This class is commonly used for testing the connectivity or response of a service. The Ping class provides mechanisms to initialize ping objects with or without specific values, compare them, and generate consistent representations for logging or debugging.
Author:
Jonas Klein
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor for the Ping class.
    Ping(long id, String content)
    Constructor for the Ping class with specified id and content.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Indicates whether some other object is "equal to" this one.
    Gets the content of the Ping object.
    long
    Gets the identifier of the Ping object.
    int
    Returns a hash code value for the Ping object.
    Returns a string representation of the Ping object.

    Methods inherited from class java.lang.Object

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

    • Ping

      public Ping()
      Default constructor for the Ping class. Initializes id to -1 and content to an empty string.
    • Ping

      public Ping(long id, String content)
      Constructor for the Ping class with specified id and content.
      Parameters:
      id - The identifier for the Ping object.
      content - The content of the Ping object.
  • Method Details

    • getId

      public long getId()
      Gets the identifier of the Ping object.
      Returns:
      The identifier (id) of the Ping object.
    • getContent

      public String getContent()
      Gets the content of the Ping object.
      Returns:
      The content of the Ping object.
    • equals

      public boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. Equality is based on the equality of the id and content fields.
      Overrides:
      equals in class Object
      Parameters:
      o - The reference object with which to compare.
      Returns:
      true if this object is the same as the obj argument; false otherwise.
    • hashCode

      public int hashCode()
      Returns a hash code value for the Ping object. The hash code is based on the id and content fields.
      Overrides:
      hashCode in class Object
      Returns:
      A hash code value for the Ping object.
    • toString

      public String toString()
      Returns a string representation of the Ping object. The string representation consists of the class name and the id and content fields.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the Ping object.