LensSpec

open class LensSpec<IN : Any, OUT>(val location: String, paramMeta: ParamMeta, get: LensGet<IN, OUT>) : LensBuilder<IN, OUT>

Represents a uni-directional extraction of an entity from a target.

Inheritors

Constructors

Link copied to clipboard
constructor(location: String, paramMeta: ParamMeta, get: LensGet<IN, OUT>)

Properties

Link copied to clipboard
Link copied to clipboard
open val multi: LensBuilder<IN, List<OUT>>

Functions

Link copied to clipboard
open override fun defaulted(name: String, default: OUT, description: String?, metadata: Map<String, Any>): Lens<IN, OUT>

Make a concrete Lens for this spec that falls back to the default value if no value is found in the target.

open override fun defaulted(name: String, default: LensExtractor<IN, OUT>, description: String?, metadata: Map<String, Any>): Lens<IN, OUT>

Make a concrete Lens for this spec that falls back to another lens if no value is found in the target.

Link copied to clipboard
fun <NEXT> map(nextIn: (OUT) -> NEXT): LensSpec<IN, NEXT>

Create another LensSpec which applies the uni-directional transformation to the result. Any resultant Lens can only be used to extract the final type from a target.

Link copied to clipboard
open override fun optional(name: String, description: String?, metadata: Map<String, Any>): Lens<IN, OUT?>

Make a concrete Lens for this spec that looks for an optional value in the target.

Link copied to clipboard
open override fun required(name: String, description: String?, metadata: Map<String, Any>): Lens<IN, OUT>

Make a concrete Lens for this spec that looks for a required value in the target.