https://github.com/voomdoon/vd-from-properties-parser
https://github.com/voomdoon/vd-from-properties-parser
config-parser dot-properties nested-objects parsing properties-parser
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/voomdoon/vd-from-properties-parser
- Owner: voomdoon
- License: apache-2.0
- Created: 2024-03-20T04:43:07.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-12-18T05:57:15.000Z (about 1 month ago)
- Last Synced: 2025-12-21T14:59:11.008Z (28 days ago)
- Topics: config-parser, dot-properties, nested-objects, parsing, properties-parser
- Language: Java
- Homepage:
- Size: 43 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vd-from-properties-parser
A lightweight, reflection-based utility to populate Java objects from `Properties`.
Supports nested structures, collections, maps, interfaces (via `class` property), and uses `FromStringParsers` to support string-based conversions for individual properties.
---
## Features
- Populate object fields via `Properties`
- Supports:
- Collections (inline or indexed)
- Maps (inline or recursive)
- Nested objects (recursively parsed)
- Polymorphism (via `.class` property)
- Works out of the box — no annotations or frameworks required
- Extensible with custom parsers via SPI (see [vd-from-string-parser](https://github.com/voomdoon/vd-from-string-parser))
---
## Comparison
| Feature | `vd-from-properties-parser` | [Spring Boot](https://docs.spring.io/spring-boot/docs/current/reference/html/application-properties.html#application-properties) | [Apache Commons Configuration](https://commons.apache.org/proper/commons-configuration/) | [Owner](https://github.com/matteobaccan/owner) |
|-------------------------------|-----------------------------|-------------|------------------------|-------|
| Works with plain `Properties` | ✅ | ❌ | ✅ | ✅ |
| Deep/nested object support | ✅ | ✅ | ❌ | ❌ |
| Custom parsers via SPI | ✅ | ❌ | ❌ | ❌ |
| Reflection-based (no annotations) | ✅ | ❌ | ❌ | ❌ |
| Lightweight (no framework) | ✅ | ❌ | ✅ | ✅ |
---
## Examples
### Collection
**Inline:**
```properties
collection=a,b,c
```
**Using integer index:**
```properties
collection.0=a
collection.1=b
collection.3=c
```
**Using any index:**
```properties
collection.a=a
collection.b=b
collection.z=c
```
**With recursion:**
```properties
collection.0.string=a
collection.1.string=b
```
View classes
### MyObject
```java
public class MyObject {
public Collection collection;
}
```
### MySubObject
```java
public class MySubObject {
public String string;
}
```
---
### Map
**Inline:**
```properties
map.abc=123
```
**Using any index with explicit key and value:**
```properties
map.0.key=abc
map.0.value=123
```
**With recursion:**
```properties
map.0.key.string=a
map.0.value.string=1
```
View classes
### MyObject
```java
public class MyObject {
public Map map;
}
```
### MySubObject
```java
public class MySubObject {
public String string;
}
```
---
### Inheritance
**Specify implementing class for an interface:**
```properties
object.class=MyImplementation
object.string=abc
```
View classes
### MyInterface
```java
public interface MyInterface {}
```
### MyImplementation
```java
public class MyImplementation implements MyInterface {
public String string;
}
```