api

http4k / org.http4k.lens / LensSpec

LensSpec

open class LensSpec<IN : Any, OUT> (source)

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

Constructors

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

Properties

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

Functions

Name Summary
defaulted open fun defaulted(name: String, default: OUT, description: String? = null): 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 fun defaulted(name: String, default: Lens<IN, 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.
map 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.
optional open fun optional(name: String, description: String? = null): Lens<IN, OUT?>
Make a concrete Lens for this spec that looks for an optional value in the target.
required open fun required(name: String, description: String? = null): Lens<IN, OUT>
Make a concrete Lens for this spec that looks for a required value in the target.

Extension Functions

Name Summary
with fun <T> T.with(vararg modifiers: (T) -> T): T

Inheritors

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