api

http4k / org.http4k.lens / LensSpec

LensSpec

open class LensSpec<IN : Any, OUT>

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

Constructors

Name Summary
<init> Represents a uni-directional extraction of an entity from a target.LensSpec(location: String, paramMeta: ParamMeta, get: LensGet<IN, OUT>)

Properties

Name Summary
location val location: String
multi open val multi: MultiLensSpec<IN, OUT>
paramMeta val paramMeta: ParamMeta

Functions

Name Summary
defaulted Make a concrete Lens for this spec that falls back to the default value if no value is found in the target.open fun defaulted(name: String, default: OUT, description: String? = null): Lens<IN, OUT>
Make a concrete Lens for this spec that falls back to another lens if no value is found in the target.open fun defaulted(name: String, default: Lens<IN, OUT>, description: String? = null): Lens<IN, OUT>
map 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.fun <NEXT> map(nextIn: (OUT) -> NEXT): LensSpec<IN, NEXT>
optional Make a concrete Lens for this spec that looks for an optional value in the target.open fun optional(name: String, description: String? = null): Lens<IN, OUT?>
required Make a concrete Lens for this spec that looks for a required value in the target.open fun required(name: String, description: String? = null): Lens<IN, OUT>

Inheritors

Name Summary
BiDiLensSpec Represents a bi-directional extraction of an entity from a target, or an insertion into a target.open class BiDiLensSpec<IN : Any, OUT> : LensSpec<IN, OUT>