http4k / org.http4k.format

Package org.http4k.format

Common code relevant to the various message format implementations (eg. JSON).


Name Summary
Argo object Argo : Json<JsonNode>
AutoMappingConfiguration This is the generic interface used to configure auto-mapping functionality for message format libraries. The various methods here can be used to provide custom mapping behaviour (say for domain classes).interface AutoMappingConfiguration<BUILDER>
AutoMarshalling Common base type for all format libraries which can convert directly from String -> Classesabstract class AutoMarshalling
AutoMarshallingJson abstract class AutoMarshallingJson<NODE : Any> : AutoMarshalling, Json<NODE>
AutoMarshallingXml abstract class AutoMarshallingXml : AutoMarshalling
ConfigurableGson open class ConfigurableGson : AutoMarshallingJson<JsonElement>
ConfigurableJackson open class ConfigurableJackson : AutoMarshallingJson<JsonNode>
ConfigurableJacksonXml open class ConfigurableJacksonXml : AutoMarshallingXml
ConfigurableJacksonYaml open class ConfigurableJacksonYaml : AutoMarshalling
ConfigurableKlaxon open class ConfigurableKlaxon : AutoMarshalling
ConfigurableKotlinxSerialization open class ConfigurableKotlinxSerialization : AutoMarshallingJson<JsonElement>
ConfigurableMoshi open class ConfigurableMoshi : AutoMarshalling
Gson To implement custom JSON configuration, create your own object singleton. Extra mappings can be added before done() is called.object Gson : ConfigurableGson
Jackson To implement custom JSON configuration, create your own object singleton. Extra mappings can be added before done() is called.object Jackson : ConfigurableJackson
JacksonXml To implement custom XML configuration, create your own object singleton. Extra mappings can be added before done() is called.object JacksonXml : ConfigurableJacksonXml
JacksonYaml object JacksonYaml : ConfigurableJacksonYaml
Json This is the contract for all JSON implementationsinterface Json<NODE>
JsonType enum class JsonType
Klaxon To implement custom JSON configuration, create your own object singleton. Extra mappings can be added before done() is called.object Klaxon : ConfigurableKlaxon
KotlinxSerialization To implement custom JSON configuration, create your own object singleton extending ConfigurableKotlinxSerialization, passing in the JSON configuration blockobject KotlinxSerialization : ConfigurableKotlinxSerialization
Moshi To implement custom JSON configuration, create your own object singleton. Extra mappings can be added before done() is called.object Moshi : ConfigurableMoshi
SimpleMoshiAdapterFactory Convenience class to create Moshi Adapter Factoryopen class SimpleMoshiAdapterFactory : Factory
Xml object Xml : AutoMarshallingXml


Name Summary
InvalidJsonException class InvalidJsonException : RuntimeException

Extensions for External Classes

Name Summary


Name Summary
adapter Convenience function to create Moshi Adapter.fun <T : JsonAdapter<K>, K> adapter(fn: (Moshi) -> T): Pair<String!, (Moshi) -> T>
bigDecimal fun <BUILDER, OUT> AutoMappingConfiguration<BUILDER>.bigDecimal(inFn: (BigDecimal) -> OUT, outFn: (OUT) -> BigDecimal): AutoMappingConfiguration<BUILDER>
bigInteger fun <BUILDER, OUT> AutoMappingConfiguration<BUILDER>.bigInteger(inFn: (BigInteger) -> OUT, outFn: (OUT) -> BigInteger): AutoMappingConfiguration<BUILDER>
boolean fun <BUILDER, OUT> AutoMappingConfiguration<BUILDER>.boolean(inFn: (Boolean) -> OUT, outFn: (OUT) -> Boolean): AutoMappingConfiguration<BUILDER>
double fun <BUILDER, OUT> AutoMappingConfiguration<BUILDER>.double(outFn: (OUT) -> Double, inFn: (Double) -> OUT): AutoMappingConfiguration<BUILDER>
duration fun <BUILDER, OUT> AutoMappingConfiguration<BUILDER>.duration(inFn: (Duration) -> OUT, outFn: (OUT) -> Duration): AutoMappingConfiguration<BUILDER>
httpBodyLens fun httpBodyLens(description: String? = null, contentNegotiation: ContentNegotiation = None, contentType: ContentType): <ERROR CLASS>
instant fun <BUILDER, OUT> AutoMappingConfiguration<BUILDER>.instant(inFn: (Instant) -> OUT, outFn: (OUT) -> Instant): AutoMappingConfiguration<BUILDER>
int fun <BUILDER, OUT> AutoMappingConfiguration<BUILDER>.int(inFn: (Int) -> OUT, outFn: (OUT) -> Int): AutoMappingConfiguration<BUILDER>
localDate fun <BUILDER, OUT> AutoMappingConfiguration<BUILDER>.localDate(inFn: (LocalDate) -> OUT, outFn: (OUT) -> LocalDate): AutoMappingConfiguration<BUILDER>
localDateTime fun <BUILDER, OUT> AutoMappingConfiguration<BUILDER>.localDateTime(inFn: (LocalDateTime) -> OUT, outFn: (OUT) -> LocalDateTime): AutoMappingConfiguration<BUILDER>
localTime fun <BUILDER, OUT> AutoMappingConfiguration<BUILDER>.localTime(inFn: (LocalTime) -> OUT, outFn: (OUT) -> LocalTime): AutoMappingConfiguration<BUILDER>
long fun <BUILDER, OUT> AutoMappingConfiguration<BUILDER>.long(inFn: (Long) -> OUT, outFn: (OUT) -> Long): AutoMappingConfiguration<BUILDER>
offsetDateTime fun <BUILDER, OUT> AutoMappingConfiguration<BUILDER>.offsetDateTime(inFn: (OffsetDateTime) -> OUT, outFn: (OUT) -> OffsetDateTime): AutoMappingConfiguration<BUILDER>
offsetTime fun <BUILDER, OUT> AutoMappingConfiguration<BUILDER>.offsetTime(inFn: (OffsetTime) -> OUT, outFn: (OUT) -> OffsetTime): AutoMappingConfiguration<BUILDER>
text This is the set of utility methods which avoid the noise of creating a BiDiMapping when specifying mappings.fun <BUILDER, OUT> AutoMappingConfiguration<BUILDER>.text(inFn: (String) -> OUT, outFn: (OUT) -> String): AutoMappingConfiguration<BUILDER>
Utility method for when only writing/serialization is requiredfun <BUILDER, OUT> AutoMappingConfiguration<BUILDER>.text(mapping: (OUT) -> String): AutoMappingConfiguration<BUILDER>
Utility method for when only reading/deserialization is requiredfun <BUILDER, OUT> AutoMappingConfiguration<BUILDER>.text(mapping: (String) -> OUT): AutoMappingConfiguration<BUILDER>
uri fun <BUILDER, OUT> AutoMappingConfiguration<BUILDER>.uri(inFn: (Uri) -> OUT, outFn: (OUT) -> Uri): AutoMappingConfiguration<BUILDER>
uuid fun <BUILDER, OUT> AutoMappingConfiguration<BUILDER>.uuid(inFn: (UUID) -> OUT, outFn: (OUT) -> UUID): AutoMappingConfiguration<BUILDER>
withStandardMappings This is the set of (additional) standardised string <-> type mappings which http4k supports out of the box.fun <T> AutoMappingConfiguration<T>.withStandardMappings(): AutoMappingConfiguration<T>
yearMonth fun <BUILDER, OUT> AutoMappingConfiguration<BUILDER>.yearMonth(inFn: (YearMonth) -> OUT, outFn: (OUT) -> YearMonth): AutoMappingConfiguration<BUILDER>
zonedDateTime fun <BUILDER, OUT> AutoMappingConfiguration<BUILDER>.zonedDateTime(inFn: (ZonedDateTime) -> OUT, outFn: (OUT) -> ZonedDateTime): AutoMappingConfiguration<BUILDER>