Record Class Answer

java.lang.Object
java.lang.Record
net.ygbstudio.jbrave.core.domain.dto.web.Answer
Record Components:
text - The text content of the answer.
author - The name or identifier of the author who provided the answer.
upvoteCount - The number of upvotes the answer has received.
downvoteCount - The number of downvotes the answer has received.

public record Answer(String text, String author, Integer upvoteCount, Integer downvoteCount) extends Record
Represents an answer to a question in the FAQ section of Brave Search API responses. This is typically used in the context of question-and-answer content, forum posts, or community answers.
  • Constructor Details

    • Answer

      public Answer(String text, String author, Integer upvoteCount, Integer downvoteCount)
      Creates an instance of a Answer record class.
      Parameters:
      text - the value for the text record component
      author - the value for the author record component
      upvoteCount - the value for the upvoteCount record component
      downvoteCount - the value for the downvoteCount record component
  • Method Details

    • 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.
    • text

      public String text()
      Returns the value of the text record component.
      Returns:
      the value of the text record component
    • author

      public String author()
      Returns the value of the author record component.
      Returns:
      the value of the author record component
    • upvoteCount

      public Integer upvoteCount()
      Returns the value of the upvoteCount record component.
      Returns:
      the value of the upvoteCount record component
    • downvoteCount

      public Integer downvoteCount()
      Returns the value of the downvoteCount record component.
      Returns:
      the value of the downvoteCount record component