com.github.sparkmuse:properties-mapper

This project is to map yaml properties to java beans.

Лицензия

Лицензия

Группа

Группа

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

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

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

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

1.1.10
Дата

Дата

Тип

Тип

jar
Описание

Описание

com.github.sparkmuse:properties-mapper
This project is to map yaml properties to java beans.
Ссылка на сайт

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

https://github.com/sparkmuse/properties-mapper
Система контроля версий

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

https://github.com/sparkmuse/properties-mapper

Скачать properties-mapper

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

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

Зависимости

compile (3)

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

test (3)

Идентификатор библиотеки Тип Версия
org.projectlombok : lombok jar 1.18.12
org.junit.jupiter : junit-jupiter jar 5.6.0
org.assertj : assertj-core jar 3.13.2

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

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

Properties Mapper

Small project to easily map properties in yaml to Java POJOs

Install

Add the bellow dependency to your maven project

<dependency>
    <groupId>com.github.sparkmuse</groupId>
    <artifactId>properties-mapper</artifactId>
    <version>${version}</version>
</dependency>

or to gradle

compile 'com.github.sparkmuse:properties-mapper:${version}'

The version can be obtained by going to the link https://mvnrepository.com/artifact/com.github.sparkmuse/property-mapper

Usage

Create the java POJO to be bound to the yaml properties and annotate it

@Property(source="person.yaml", prefix = "person")
public class Person {
    private String name;
    private Long age;

    // No arguments constructor
    
    // Standard getters and setters
}

And on the yaml file person.yaml

person:
  name: John
  age: 25

An instance of the property can be accessed as follows

public class Main {
    public static void main(String[] args) {
        
        // Get an instance of person with all values filled in
        Optional<Person> person = Binder.get(Person.class);
        
        if (person.isPresent()) {
            System.out.println("I have created a person!");
        }
    }
}

Description

  • Source: This is the source of the file containing the values for the mapping.
  • Prefix: The prefix where the values can be accessed. It can be empty if the elements are in the top level yaml document.

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

Версия
1.1.10
1.1.9