Skip to content

Latest commit

 

History

History
55 lines (43 loc) · 1.13 KB

README.md

File metadata and controls

55 lines (43 loc) · 1.13 KB

sequentia Build Status

Sequential data to Java objects

Description

Extracting data

Given raw data:

"John    00000300000015000"

And a mapped bean:

//...
public class Person {

    @SequentialMapping(length = 8)
    private String name;

    @SequentialMapping(length = 7, pad = LEFT, padCharacter = '0')
    private Integer age;

    @SequentialMapping(length = 10, pad = LEFT, padCharacter = '0')
    private Long income;
//...

com.rnnds.sequentia.Extractor will retrieve a populated bean:

Person result = new Extractor().extract(Person.class, "John    00000300000015000")
result.getName(); //John
result.getAge(); //30
result.getIncome(); //15000

Generating data

Given a mapped bean:

//...
public class Person {

    @SequentialMapping(length = 5)
    private String name = "Peter";

    @SequentialMapping(length = 5, pad = LEFT, padCharacter = '0')
    private Integer age;
//...

com.rnnds.sequentia.Generator will retrieve:

new Generator().generate(new Person()); //Peter00050

👍