Package-level declarations

Types

Link copied to clipboard
class ArraySchema<T>(val elementSchema: FateSchema<T>) : FateSchema<Array<T>>

A schema for arrays of T, written as a 4-byte element count followed by each element.

Link copied to clipboard

Encodes a BooleanArray as an array of BOOLEAN, one byte per element.

Link copied to clipboard
Link copied to clipboard
class CustomStructSchema<T : Any>(val type: String, val componentNames: List<String>, val componentSchemas: List<FateSchema<*>>, val encoder: (T) -> List<Any>) : FateSchema<T>

A schema you define by hand. You name the components and supply a function that produces them.

Link copied to clipboard

Encodes a DoubleArray as an array of DOUBLE.

Link copied to clipboard
Link copied to clipboard
class DynamicEnumSchema(val constantNames: List<String>) : FateSchema<String>

Writes the same bytes as EnumSchema, but takes the constant name as a String instead of an enum value. Throws IllegalArgumentException for a name that is not in constantNames.

Link copied to clipboard
class EnumSchema<T : Enum<T>>(val enumClass: Class<out Enum<T>>) : FateSchema<T>

Encodes an enum constant as its 4-byte ordinal.

Link copied to clipboard
Link copied to clipboard
sealed interface FateSchema<T>

Describes how one type becomes bytes.

Link copied to clipboard

Encodes a FloatArray as an array of DOUBLE, widening each element.

Link copied to clipboard

Encodes an IntArray as an array of INT.

Link copied to clipboard
Link copied to clipboard
class JavaOptionalSchema<T : Any>(val valueSchema: FateSchema<T>) : FateSchema<Optional<T>>

A schema for java.util.Optional, encoded exactly like OptionalSchema.

Link copied to clipboard

Encodes a LongArray as an array of LONG.

Link copied to clipboard
Link copied to clipboard
class MapSchema<K, V>(val keySchema: FateSchema<K>, val valueSchema: FateSchema<V>) : FateSchema<@JvmSuppressWildcards Map<K, V>>

A schema for maps with independently typed keys and values.

Link copied to clipboard

Encodes an OptionalDouble like an optional DOUBLE.

Link copied to clipboard

Encodes an OptionalInt like an optional INT.

Link copied to clipboard

Encodes an OptionalLong like an optional LONG.

Link copied to clipboard
class OptionalSchema<T : Any>(val valueSchema: FateSchema<T>) : FateSchema<T?>

A schema for values that may be absent, wrapping the schema for the value itself.

Link copied to clipboard
sealed class PrimitiveArraySchema<A : Any> : FateSchema<A>

Base for the schemas of Kotlin's primitive arrays.

Link copied to clipboard

Base for the schemas of OptionalInt, OptionalLong and OptionalDouble. These classes are not generic, so inference needs no type argument.

Link copied to clipboard
open class ReflectedClassSchema<T : Any>(val fields: Map<String, FateSchema<*>>) : FateSchema<T>
Link copied to clipboard
Link copied to clipboard
class TranslatedSchema<T : Any, U : Any>(val baseSchema: FateSchema<U>, val toBase: (T) -> U) : FateSchema<T>

A schema that converts a T to a U and encodes the result with baseSchema.

Link copied to clipboard
class TypedClassSchema<T : Any>(val type: String, fields: Map<String, FateSchema<*>>) : ReflectedClassSchema<T>