http4k / org.http4k.lens / BiDiLensSpec


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

Represents a bi-directional extraction of an entity from a target, or an insertion into a target.


Name Summary
<init> BiDiLensSpec(location: String, paramMeta: ParamMeta, get: LensGet<IN, OUT>, set: LensSet<IN, OUT>)
Represents a bi-directional extraction of an entity from a target, or an insertion into a target.


Name Summary
multi open val multi: BiDiMultiLensSpec<IN, OUT>

Inherited Properties

Name Summary
location val location: String
paramMeta val paramMeta: ParamMeta


Name Summary
defaulted open fun defaulted(name: String, default: OUT, description: String?): BiDiLens<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?): BiDiLens<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, nextOut: (NEXT) -> OUT): BiDiLensSpec<IN, NEXT>
Create another BiDiLensSpec which applies the bi-directional transformations to the result. Any resultant Lens can be used to extract or insert the final type from/into a target.
optional open fun optional(name: String, description: String?): BiDiLens<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?): BiDiLens<IN, OUT>
Make a concrete Lens for this spec that looks for a required value in the target.

Inherited Functions

Name Summary
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.

Extension Functions

Name Summary
authority fun <IN : Any> BiDiLensSpec<IN, String>.authority(): BiDiLensSpec<IN, Authority>
base64 fun <IN : Any> BiDiLensSpec<IN, String>.base64(): BiDiLensSpec<IN, String>
bigDecimal fun <IN : Any> BiDiLensSpec<IN, String>.bigDecimal(): BiDiLensSpec<IN, BigDecimal>
bigInteger fun <IN : Any> BiDiLensSpec<IN, String>.bigInteger(): BiDiLensSpec<IN, BigInteger>
boolean fun <IN : Any> BiDiLensSpec<IN, String>.boolean(): BiDiLensSpec<IN, Boolean>
bytes fun <IN : Any> BiDiLensSpec<IN, String>.bytes(): LensSpec<IN, ByteArray>
dateTime fun <IN : Any> BiDiLensSpec<IN, String>.dateTime(formatter: DateTimeFormatter = ISO_LOCAL_DATE_TIME): BiDiLensSpec<IN, LocalDateTime!>
double fun <IN : Any> BiDiLensSpec<IN, String>.double(): BiDiLensSpec<IN, Double>
duration fun <IN : Any> BiDiLensSpec<IN, String>.duration(): BiDiLensSpec<IN, Duration!>
float fun <IN : Any> BiDiLensSpec<IN, String>.float(): BiDiLensSpec<IN, Float>
host fun <IN : Any> BiDiLensSpec<IN, String>.host(): BiDiLensSpec<IN, Host>
instant fun <IN : Any> BiDiLensSpec<IN, String>.instant(): BiDiLensSpec<IN, Instant!>
int fun <IN : Any> BiDiLensSpec<IN, String>.int(): BiDiLensSpec<IN, Int>
localDate fun <IN : Any> BiDiLensSpec<IN, String>.localDate(formatter: DateTimeFormatter = ISO_LOCAL_DATE): BiDiLensSpec<IN, LocalDate!>
localTime fun <IN : Any> BiDiLensSpec<IN, String>.localTime(formatter: DateTimeFormatter = ISO_LOCAL_TIME): BiDiLensSpec<IN, LocalTime!>
long fun <IN : Any> BiDiLensSpec<IN, String>.long(): BiDiLensSpec<IN, Long>
map fun <NEXT, IN : Any, OUT> BiDiLensSpec<IN, OUT>.map(mapping: BiDiMapping<OUT, NEXT>): BiDiLensSpec<IN, NEXT>
nonEmptyString fun <IN : Any> BiDiLensSpec<IN, String>.nonEmptyString(): BiDiLensSpec<IN, String>
offsetDateTime fun <IN : Any> BiDiLensSpec<IN, String>.offsetDateTime(formatter: DateTimeFormatter = ISO_OFFSET_DATE_TIME): BiDiLensSpec<IN, OffsetDateTime!>
offsetTime fun <IN : Any> BiDiLensSpec<IN, String>.offsetTime(formatter: DateTimeFormatter = ISO_OFFSET_TIME): BiDiLensSpec<IN, OffsetTime!>
port fun <IN : Any> BiDiLensSpec<IN, String>.port(): BiDiLensSpec<IN, Port>
regex fun <IN : Any> BiDiLensSpec<IN, String>.regex(pattern: String, group: Int = 1): BiDiLensSpec<IN, String>
regexObject fun <IN : Any> BiDiLensSpec<IN, String>.regexObject(): BiDiLensSpec<IN, Regex>
secret fun <IN : Any> BiDiLensSpec<IN, String>.secret(): LensSpec<IN, Secret>
string fun <IN : Any> BiDiLensSpec<IN, String>.string(): BiDiLensSpec<IN, String>
timeout fun <IN : Any> BiDiLensSpec<IN, String>.timeout(): BiDiLensSpec<IN, Timeout>
uri fun <IN : Any> BiDiLensSpec<IN, String>.uri(): BiDiLensSpec<IN, Uri>
uuid fun <IN : Any> BiDiLensSpec<IN, String>.uuid(): BiDiLensSpec<IN, UUID!>
with fun <T> T.with(vararg modifiers: (T) -> T): T
zonedDateTime fun <IN : Any> BiDiLensSpec<IN, String>.zonedDateTime(formatter: DateTimeFormatter = ISO_ZONED_DATE_TIME): BiDiLensSpec<IN, ZonedDateTime!>


Name Summary
Cookies object Cookies : BiDiLensSpec<Request, Cookie>
EnvironmentKey object EnvironmentKey : BiDiLensSpec<Environment, String>
This models the key used to get a value out of the Environment using the standard Lens mechanic. Note that if your values contain commas, either use a EnvironmentKey.(mapping).multi.required()/optional()/defaulted() to retrieve the entire list, or override the comma separator in your initial Environment.
FormField object FormField : BiDiLensSpec<WebForm, String>
Header object Header : BiDiLensSpec<HttpMessage, String>
MultipartFormField object MultipartFormField : BiDiLensSpec<MultipartForm, String>
MultipartFormFile object MultipartFormFile : BiDiLensSpec<MultipartForm, FormFile>
Query object Query : BiDiLensSpec<Request, String>