An open API service indexing awesome lists of open source software.

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

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;
}
```