io.github.mattvass:json-resultset-mapper

This allows users to simply convert their result set to json.

Лицензия

Лицензия

Категории

Категории

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

Группа

io.github.mattvass
Идентификатор

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

json-resultset-mapper
Последняя версия

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

1.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

io.github.mattvass:json-resultset-mapper
This allows users to simply convert their result set to json.
Ссылка на сайт

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

http://maven.apache.org
Система контроля версий

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

https://github.com/mattvass/json-resultset-mapper/tree/master

Скачать json-resultset-mapper

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

<!-- https://jarcasting.com/artifacts/io.github.mattvass/json-resultset-mapper/ -->
<dependency>
    <groupId>io.github.mattvass</groupId>
    <artifactId>json-resultset-mapper</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.mattvass/json-resultset-mapper/
implementation 'io.github.mattvass:json-resultset-mapper:1.0.1'
// https://jarcasting.com/artifacts/io.github.mattvass/json-resultset-mapper/
implementation ("io.github.mattvass:json-resultset-mapper:1.0.1")
'io.github.mattvass:json-resultset-mapper:jar:1.0.1'
<dependency org="io.github.mattvass" name="json-resultset-mapper" rev="1.0.1">
  <artifact name="json-resultset-mapper" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.mattvass', module='json-resultset-mapper', version='1.0.1')
)
libraryDependencies += "io.github.mattvass" % "json-resultset-mapper" % "1.0.1"
[io.github.mattvass/json-resultset-mapper "1.0.1"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
javax.json : javax.json-api jar 1.1.2
org.glassfish : javax.json jar 1.1.2
org.apache.commons : commons-text jar 1.4

test (2)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12
org.mockito : mockito-all jar 1.9.5

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

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

Json ResultSet Mapper

Maven Central CircleCI

This allows users to simply convert their result set to json.

The following types will be cast to the appropriate type:

  • String
  • Integer
  • BigDecimal
  • Long
  • Double
  • Boolean
  • Short

Currently all other values are converted to strings values or JsonValue.NULL if the returned value is null.

The java.sql.ResultSet.getObject method is used to ensure no primitive types are set, due to methods like getBoolean or getDouble returning primitive values which have defaults. The getObject method seemed like the logical choice to ensure we are not setting any default values that weren't expected by the end user.

Add as a dependency

<dependency>
  <groupId>io.github.mattvass</groupId>
  <artifactId>json-resultset-mapper</artifactId>
  <version>see-version-number-above</version>
</dependency>

Simple Implementation

new JsonResultSet().toJson(resultSet);

Example Json Output

{
	"results": [{
		"stringColumn": "string value",
		"integerColumn": 39,
		"booleanColumn": true,
		"doubleColumn": 150000.0,
		"bigdecimalColumn": 10,
		"shortColumn": 123,
		"longColumn": 12345678910,
		"timeColumn": "10:11:12",
		"timestampColumn": "1970-05-23 17:21:18.91",
		"dateColumn": "1970-05-23"
	}, {
		"stringColumn": "string value",
		"integerColumn": 39,
		"booleanColumn": true,
		"doubleColumn": 150000.0,
		"bigdecimalColumn": 10,
		"shortColumn": 123,
		"longColumn": 12345678910,
		"timeColumn": "10:11:12",
		"timestampColumn": "1970-05-23 17:21:18.91",
		"dateColumn": "1970-05-23"
	}]
}

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

Версия
1.0.1
1.0