Skip to content

voomdoon/vd-from-properties-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

Comparison

Feature vd-from-properties-parser Spring Boot Apache Commons Configuration Owner
Works with plain Properties
Deep/nested object support
Custom parsers via SPI
Reflection-based (no annotations)
Lightweight (no framework)

Examples

Collection

Inline:

collection=a,b,c

Using integer index:

collection.0=a
collection.1=b
collection.3=c

Using any index:

collection.a=a
collection.b=b
collection.z=c

With recursion:

collection.0.string=a
collection.1.string=b
View classes

MyObject

public class MyObject {
    public Collection<MySubObject> collection;
}

MySubObject

public class MySubObject {
    public String string;
}

Map

Inline:

map.abc=123

Using any index with explicit key and value:

map.0.key=abc
map.0.value=123

With recursion:

map.0.key.string=a
map.0.value.string=1
View classes

MyObject

public class MyObject {
    public Map<MySubObject, MySubObject> map;
}

MySubObject

public class MySubObject {
    public String string;
}

Inheritance

Specify implementing class for an interface:

object.class=MyImplementation
object.string=abc
View classes

MyInterface

public interface MyInterface {}

MyImplementation

public class MyImplementation implements MyInterface {
    public String string;
}

Releases

No releases published

Packages

No packages published

Languages