Package com.squareup.moshi.kotlin.codegen.api

Types

AdapterGenerator
Link copied to clipboard
class AdapterGenerator(target: TargetType, propertyList: List<PropertyGenerator>)

Generates a JSON adapter for a target type.

DelegateKey
Link copied to clipboard
data class DelegateKey(type: TypeName, jsonQualifiers: List<AnnotationSpec>)

A JsonAdapter that can be used to encode and decode a particular field.

InternalMoshiCodegenApi
Link copied to clipboard
annotation class InternalMoshiCodegenApi

Internal Moshi code gen APIs.

Options
Link copied to clipboard
object Options
PreparedAdapter
Link copied to clipboard
data class PreparedAdapter(spec: FileSpec, proguardConfig: ProguardConfig?)

Represents a prepared adapter with its spec and optional associated proguardConfig.

ProguardConfig
Link copied to clipboard
data class ProguardConfig(targetClass: ClassName, adapterName: String, adapterConstructorParams: List<String>, targetConstructorHasDefaults: Boolean, targetConstructorParams: List<String>)

Represents a proguard configuration for a given spec. This covers three main areas:

PropertyGenerator
Link copied to clipboard
class PropertyGenerator(target: TargetProperty, delegateKey: DelegateKey, isTransient: Boolean)

Generates functions to encode and decode a property as JSON.

QualifierAdapterProperty
Link copied to clipboard
data class QualifierAdapterProperty(name: String, qualifiers: Set<ClassName>)

Represents a qualified property with its name in the adapter fields and list of qualifiers associated with it.

TargetConstructor
Link copied to clipboard
data class TargetConstructor(parameters: LinkedHashMap<String, TargetParameter>, visibility: KModifier, signature: String?)

A constructor in user code that should be called by generated code.

TargetParameter
Link copied to clipboard
data class TargetParameter(name: String, index: Int, type: TypeName, hasDefault: Boolean, jsonName: String?, jsonIgnore: Boolean, qualifiers: Set<AnnotationSpec>?)

A parameter in user code that should be populated by generated code.

TargetProperty
Link copied to clipboard
data class TargetProperty(propertySpec: PropertySpec, parameter: TargetParameter?, visibility: KModifier, jsonName: String?, jsonIgnore: Boolean)

A property in user code that maps to JSON.

TargetType
Link copied to clipboard
data class TargetType(typeName: TypeName, constructor: TargetConstructor, properties: Map<String, TargetProperty>, typeVariables: List<TypeVariableName>, isDataClass: Boolean, visibility: KModifier)

A user type that should be decoded and encoded by generated code.