http4k / org.http4k.lens / 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.


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


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


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?): BiDiLens<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?): BiDiLens<IN, OUT>
map 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.fun <NEXT> map(nextIn: (OUT) -> NEXT, nextOut: (NEXT) -> OUT): BiDiLensSpec<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?): BiDiLens<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?): BiDiLens<IN, OUT>

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>
composite This allows creation of a composite object from several values from the same source.fun <TARGET : Any, T> BiDiLensSpec<TARGET, String>.composite(fn: BiDiLensSpec<TARGET, String>.(TARGET) -> T): Lens<TARGET, T>fun <TARGET : Any, T> BiDiLensSpec<TARGET, String>.composite(getFn: BiDiLensSpec<TARGET, String>.(TARGET) -> T, setFn: T.(TARGET) -> TARGET): BiDiLens<TARGET, T>
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!>
enum fun <IN : Any, T : Enum<T>> BiDiLensSpec<IN, String>.enum(): BiDiLensSpec<IN, T>
fun <T : Enum<T>> BiDiLensSpec<WebForm, String>.enum(): BiDiLensSpec<WebForm, T>
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!>
yearMonth fun <IN : Any> BiDiLensSpec<IN, String>.yearMonth(): BiDiLensSpec<IN, YearMonth!>
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 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.object EnvironmentKey : BiDiLensSpec<Environment, String>
FormField object FormField : BiDiLensSpec<WebForm, String>
Header object Header : BiDiLensSpec<HttpMessage, String>
Query object Query : BiDiLensSpec<Request, String>