Module quak.framework.web.model
Record Class Response<T>
java.lang.Object
java.lang.Record
io.john.amiscaray.quak.http.response.Response<T>
- Type Parameters:
T- The type of the response body.- Record Components:
headers- The headers as a map.status- The status code.body- The response body.
Represents an HTTP response.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbody()Returns the value of thebodyrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.headers()Returns the value of theheadersrecord component.static <T> Response<T> of(T body) Returns a response with the given response body and status code of 200.intstatus()Returns the value of thestatusrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Response
Create a response with no headers.- Parameters:
status- The HTTP status code.body- The response body.
-
Response
Creates an instance of aResponserecord class.
-
-
Method Details
-
of
Returns a response with the given response body and status code of 200.- Type Parameters:
T- The type of the body.- Parameters:
body- The response body.- Returns:
- A response object.
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
headers
Returns the value of theheadersrecord component.- Returns:
- the value of the
headersrecord component
-
status
public int status()Returns the value of thestatusrecord component.- Returns:
- the value of the
statusrecord component
-
body
Returns the value of thebodyrecord component.- Returns:
- the value of the
bodyrecord component
-