ListAdapter

class ListAdapter<T>(wrappedAdapter: Adapter<T>) : Adapter<List<@JvmSuppressWildcards T>>

This file contains a list of Adapter for standard types

They are mostly used from the generated code but could be useful in any other situations that requires adapting from GraphQL to Kotlin. In particular, AnyAdapter can be used to read/write a Kotlin representation from/to Json.

Constructors

Link copied to clipboard
constructor(wrappedAdapter: Adapter<T>)

Functions

Link copied to clipboard
@JvmName(name = "-array")
inline fun <T> Adapter<T>.array(): Adapter<Array<T>>

Note that Arrays require their type to be known at compile time, so we construct an anonymous object with reference to function with reified type parameters as a workaround.

Link copied to clipboard
@JvmName(name = "-catchToNull")
fun <T> Adapter<T>.catchToNull(): Adapter<T?>
Link copied to clipboard
@JvmName(name = "-catchToResult")
fun <T> Adapter<T>.catchToResult(): Adapter<FieldResult<T>>
Link copied to clipboard
@JvmName(name = "-errorAware")
fun <T> Adapter<T>.errorAware(): Adapter<T>
Link copied to clipboard
open override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): List<T>

Deserializes the given Json to the expected Kotlin type.

Link copied to clipboard
@JvmName(name = "-list")
fun <T> Adapter<T>.list(): ListAdapter<T>
Link copied to clipboard
@JvmName(name = "-nullable")
fun <T : Any> Adapter<T>.nullable(): NullableAdapter<T>
Link copied to clipboard
@JvmName(name = "-obj")
fun <T> Adapter<T>.obj(buffered: Boolean = false): ObjectAdapter<T>
Link copied to clipboard
@JvmName(name = "-optional")
fun <T> Adapter<T>.optional(): PresentAdapter<T>
Link copied to clipboard
@JvmName(name = "-present")
fun <T> Adapter<T>.present(): PresentAdapter<T>
Link copied to clipboard
open override fun toJson(writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, value: List<T>)

Serializes a Kotlin type into its equivalent Json representation.

Link copied to clipboard
@JvmName(name = "-toJson")
fun <T> Adapter<T>.toJsonString(value: T, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty, indent: String? = null): String