parser

Parses HTTP inputs to POJOs

Лицензия

Лицензия

Категории

Категории

Сеть
Группа

Группа

net.tokensmith
Идентификатор

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

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

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

0.0.3
Дата

Дата

Тип

Тип

module
Описание

Описание

parser
Parses HTTP inputs to POJOs
Ссылка на сайт

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

https://github.com/tokensmith/parser
Система контроля версий

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

https://github.com/tokensmith/parser

Скачать parser

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.slf4j : slf4j-api jar 1.7.25

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

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

parser

Parses url params to POJOS and performs validation on inputs.

Coordinates

Gradle

compile group: 'net.tokensmith', name: 'parser', version: '0.0.3'

Usage

Annotation

Annotate the class fields that should be translated with @Parameter

It accepts the following:

  • name: the url param key.
  • required: true/false, default is true.
  • nested: true/false, default is false. If true, then it will traverse this field's type. Nested keys are delimitted by a . such as, foo.id. The first @Parameter name value would be foo then field's in foo would only have it's immediate key name id, etc.
  • expected: An array of strings, default is an empty array. The input must be one of the provided values.
  • parsable: true/false, default is false. If true each item in the list will be split by the delimiter.
  • delimiter: string, default " ". If parsable is true, then each item in the list will be split by this value.
  • allowMany: true/false, default is false. If true it will allow many url keys to be present in the url. It's possible to have allowMany set to false and parsable set to true which will yield many results.

Example

public class ParserExample {
    @Parameter(name="uuid")
    private UUID id;

    @Parameter(name="greeting", expected = {"hello"})
    private String greeting;
    
    @Parameter(name="greetings", parsable = true, expected = {"Hello", "Bonjour", "Hola"})
    private List<String> greetings;
}

Translation

Perform the translation.

// this the input, url params in the form of a Map
Map<String, List<String>> params = new HashMap();

Parser parser = new ParserConfig().parser();

ParserExample example = parser.to(ParserExample.class, params);
net.tokensmith
OAuth 2.0 and OIDC Identity Server

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

Версия
0.0.3
0.0.2
0.0.1