api

http4k / org.http4k.lens / Lens

Lens

open class Lens<in IN : Any, out FINAL> : LensExtractor<IN, FINAL>, Iterable<Meta>

A Lens provides the uni-directional extraction of an entity from a target.

Constructors

Name Summary
<init> A Lens provides the uni-directional extraction of an entity from a target.Lens(meta: Meta, lensGet: (IN) -> FINAL)

Properties

Name Summary
meta val meta: Meta

Functions

Name Summary
invoke Lens operation to get the value from the targetopen operator fun invoke(target: IN): FINAL
iterator open fun iterator(): Iterator<Meta>
toString open fun toString(): String

Extension Functions

Name Summary
asResult Convert the result of a lens extraction to a Result4k type whichfun <IN, OUT> LensExtractor<IN, OUT>.asResult(): LensExtractor<IN, Result<OUT, LensFailure>>
matches Check the content of any lens on a request for routing purposes.fun <T> Lens<Request, T>.matches(fn: (T) -> Boolean): Router

Inheritors

Name Summary
BiDiLens A BiDiLens provides the bi-directional extraction of an entity from a target, or the insertion of an entity into a target.class BiDiLens<in IN : Any, FINAL> : LensInjector<FINAL, IN>, Lens<IN, FINAL>
Mapping class Mapping<IN : Any, OUT> : Lens<IN, OUT>
PathLens open class PathLens<out FINAL> : Lens<Request, FINAL>