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.- 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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionauthor()Returns the value of theauthorrecord component.Returns the value of thedownvoteCountrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.text()Returns the value of thetextrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of theupvoteCountrecord component.
-
Constructor Details
-
Answer
Creates an instance of aAnswerrecord class.- Parameters:
text- the value for thetextrecord componentauthor- the value for theauthorrecord componentupvoteCount- the value for theupvoteCountrecord componentdownvoteCount- the value for thedownvoteCountrecord component
-
-
Method Details
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
text
Returns the value of thetextrecord component.- Returns:
- the value of the
textrecord component
-
author
Returns the value of theauthorrecord component.- Returns:
- the value of the
authorrecord component
-
upvoteCount
Returns the value of theupvoteCountrecord component.- Returns:
- the value of the
upvoteCountrecord component
-
downvoteCount
Returns the value of thedownvoteCountrecord component.- Returns:
- the value of the
downvoteCountrecord component
-