Record Class JsonBodyHandler<T>
java.lang.Object
java.lang.Record
meteordevelopment.meteorclient.utils.network.JsonBodyHandler<T>
- All Implemented Interfaces:
HttpResponse.BodySubscriber<T>,Flow.Subscriber<List<ByteBuffer>>
public record JsonBodyHandler<T>(HttpResponse.BodySubscriber<InputStream> delegate, com.google.gson.Gson gson, Type type)
extends Record
implements HttpResponse.BodySubscriber<T>
-
Constructor Summary
ConstructorsConstructorDescriptionJsonBodyHandler(HttpResponse.BodySubscriber<InputStream> delegate, com.google.gson.Gson gson, Type type) Creates an instance of aJsonBodyHandlerrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondelegate()Returns the value of thedelegaterecord component.final booleanIndicates whether some other object is "equal to" this one.getBody()com.google.gson.Gsongson()Returns the value of thegsonrecord component.final inthashCode()Returns a hash code value for this object.static <T> HttpResponse.BodyHandler<T> voidvoidvoidonNext(List<ByteBuffer> item) voidonSubscribe(Flow.Subscription subscription) final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
Constructor Details
-
JsonBodyHandler
public JsonBodyHandler(HttpResponse.BodySubscriber<InputStream> delegate, com.google.gson.Gson gson, Type type) Creates an instance of aJsonBodyHandlerrecord class.- Parameters:
delegate- the value for thedelegaterecord componentgson- the value for thegsonrecord componenttype- the value for thetyperecord component
-
-
Method Details
-
ofJson
-
getBody
- Specified by:
getBodyin interfaceHttpResponse.BodySubscriber<T>
-
onSubscribe
- Specified by:
onSubscribein interfaceFlow.Subscriber<T>
-
onNext
- Specified by:
onNextin interfaceFlow.Subscriber<T>
-
onError
- Specified by:
onErrorin interfaceFlow.Subscriber<T>
-
onComplete
public void onComplete()- Specified by:
onCompletein interfaceFlow.Subscriber<T>
-
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). -
delegate
Returns the value of thedelegaterecord component.- Returns:
- the value of the
delegaterecord component
-
gson
public com.google.gson.Gson gson()Returns the value of thegsonrecord component.- Returns:
- the value of the
gsonrecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-