Jackson Module Http Query

A jackson module for allowing HTTP queries to be represented as typed objects

Лицензия

Лицензия

Категории

Категории

Jackson Данные JSON
Группа

Группа

com.github.trickl
Идентификатор

Идентификатор

jackson.module.httpquery
Последняя версия

Последняя версия

1.0.4
Дата

Дата

Тип

Тип

jar
Описание

Описание

Jackson Module Http Query
A jackson module for allowing HTTP queries to be represented as typed objects
Ссылка на сайт

Ссылка на сайт

http://github.com/trickl/jackson-module-http-query/
Система контроля версий

Система контроля версий

https://github.com/trickl/jackson-module-http-query

Скачать jackson.module.httpquery

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.trickl/jackson.module.httpquery/ -->
<dependency>
    <groupId>com.github.trickl</groupId>
    <artifactId>jackson.module.httpquery</artifactId>
    <version>1.0.4</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.trickl/jackson.module.httpquery/
implementation 'com.github.trickl:jackson.module.httpquery:1.0.4'
// https://jarcasting.com/artifacts/com.github.trickl/jackson.module.httpquery/
implementation ("com.github.trickl:jackson.module.httpquery:1.0.4")
'com.github.trickl:jackson.module.httpquery:jar:1.0.4'
<dependency org="com.github.trickl" name="jackson.module.httpquery" rev="1.0.4">
  <artifact name="jackson.module.httpquery" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.trickl', module='jackson.module.httpquery', version='1.0.4')
)
libraryDependencies += "com.github.trickl" % "jackson.module.httpquery" % "1.0.4"
[com.github.trickl/jackson.module.httpquery "1.0.4"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
com.fasterxml.jackson.core : jackson-core jar
com.fasterxml.jackson.core : jackson-databind jar
com.fasterxml.jackson.module : jackson-module-parameter-names jar

provided (1)

Идентификатор библиотеки Тип Версия
org.projectlombok : lombok jar 1.18.10

test (5)

Идентификатор библиотеки Тип Версия
org.junit.jupiter : junit-jupiter-api jar 5.4.0
org.junit.jupiter : junit-jupiter-engine jar 5.4.0
org.junit.jupiter : junit-jupiter-params jar 5.3.2
com.fasterxml.jackson.datatype : jackson-datatype-jsr310 jar
com.fasterxml.jackson.datatype : jackson-datatype-jdk8 jar

Модули Проекта

Данный проект не имеет модулей.

Jackson Module HTTP Query

Maven Central build_status Maintainability Test Coverage License

A jackson module for allowing HTTP queries to be represented as typed objects

Installation

To install from Maven Central:

<dependency>
  <groupId>com.github.trickl</groupId>
  <artifactId>jackson-module-httpquery</artifactId>
  <version>1.0.2</version>
</dependency>

Registering module

Like all standard Jackson modules (libraries that implement Module interface), registration is done as follows:

ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new HttpQueryModule());

after which functionality is available for all normal Jackson operations.

Purpose

Converts POJOs to query strings and vice versa.

  • Use type objects for convenient conversion to query strings (and back).
  • Less boilerplate code required for supporting a variety of query combinations.
  • Supports existing Jackson JSON annotations for formatting.
  • Extra annotations allow for different strategies on handling multi-valued parameters.

Usage Example

@HttpQuery
private static class TypedExample {
    private String valueA;

    private String valueB;

    private int valueC;
}

// To produce "?valueA=test&valueB=testB&valueC=123"...
TypedQuery typed = new TypedQuery(... // omitted for brevity
String queryString = objectMapper.valueToTree(typedQuery).textValue();

Features

  • Supports many Jackson annotations
    • @JsonProperty (have a different query parameter name from the variable name).
    • @JsonIgnore (don't serialize a property)
    • @JsonFormat (useful for date strings).
  • Supports new parameters
    • @HttpQuery (required to serialize to a query string, not a JSON object).
    • @HttpQueryDelimited (serialize a multi valued property using a delimited list e.g "?values=1,2,3").
    • @HttpQueryNoValue (allow boolean valueless params, e.g. "?debug")

Версии библиотеки

Версия
1.0.4
1.0.2
1.0.0
untagged-fcc97c422e3481c4c342
untagged-cf183c992681f458fe33
untagged-cb175d3bb852ab34379a
untagged-54158704b9e8d62c3778
untagged-77574feca99934e10a72
untagged-709c04a8bd219e3dc7df
untagged-430d4414b7d65796b3cc
untagged-133c0644dfc2f413339f
untagged-64f8ca772464bcf7e4b1
untagged-0a4ce149d120a46541bc