https://github.com/tvd12/properties-file
Supports to read properties, yaml file and map them to POJO
https://github.com/tvd12/properties-file
java-properties java-property-file mapping properties yaml yaml-mapping yaml-parser
Last synced: 10 months ago
JSON representation
Supports to read properties, yaml file and map them to POJO
- Host: GitHub
- URL: https://github.com/tvd12/properties-file
- Owner: tvd12
- Created: 2016-03-27T11:09:15.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2022-11-08T16:12:08.000Z (over 3 years ago)
- Last Synced: 2025-04-15T00:43:08.694Z (10 months ago)
- Topics: java-properties, java-property-file, mapping, properties, yaml, yaml-mapping, yaml-parser
- Language: Java
- Homepage:
- Size: 1.35 MB
- Stars: 6
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
[](https://travis-ci.org/tvd12/properties-file)
[](https://coveralls.io/github/tvd12/properties-file?branch=master)
[](https://maven-badges.herokuapp.com/maven-central/com.tvd12/properties-file)
[](https://www.javadoc.io/doc/com.tvd12/properties-file)
# Synopsis 
This project support for interact with properties file
# Code Example
**1. Read properties file**
```java
Properties properties = new BaseFileReader()
.read("application.properties");
```
**2. Read YAML file**
```java
Properties yamlProperties = new BaseFileReader()
.read("application.yaml");
```
**3. Read properties file with profiles**
```java
Properties propertiesAlpha = new MultiFileReader("alpha")
.read("application.properties");
```
**4. Read YAML file with profiles**
```java
Properties propertiesAlpha = new MultiFileReader("alpha")
.read("application.yaml");
```
**5. Map properties or YAML file to POJO**
```java
ApplicationConfig applicationConfigYaml = new PropertiesMapper()
.reader(new MultiFileReader("alpha"))
.file("application.yaml")
.map(ApplicationConfig.class);
```
**6. Use annotation to map**
```java
public class Config {
@Property("n")
private String name;
@Property("a")
private int age;
@Property("m")
private long money = 10;
}
```
**7. Use variable in properties file**
```properties
app.hello=world
app.hi=${app.hello}
```
**8. Use variable in yaml file**
```yaml
app.hello: world
app.hi: ${app.hello}
```
# Motivation
Proprties and YAML are using in a lot of framework and application, so we want to create a library support to read `.propertes` and `YAML` file and map them to `POJO` if you want
# Installation
```xml
com.tvd12
properties-file
1.1.8
```
# API Reference
http://www.javadoc.io/doc/com.tvd12/properties-file
# Tests
mvn test
# Contact us
- Touch us on [Facebook](https://www.facebook.com/youngmonkeys.org)
- Ask us on [stackask.com](https://stackask.com)
- Email to me [Dzung](mailto:itprono3@gmail.com)
# License
- Apache License, Version 2.0