poetix / octarine

Java 8 functional magic

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example (Address/Person) in README has issues

pyoio opened this issue · comments

Having a play around with version 0.2 from maven, I really like this approach for working with data!

Couple of things:

  1. Example code:
age.from(r).ifPresent(a -> { if (a < 0) v.accept("Age must be 0 or greater"); });
address.from(r).ifPresent(a -> Address.schema.accept(a, v));

should use get(r) instead of from(r).

  1. Example code:
JsonDeserialiser reader = i ->
    i.add(addressLines, fromString)
    .add(postcode, fromString);

JsonSerialiser writer = p ->
    p.add(addressLines, asString)
    .add(postcode, asString);

both lines containing addressLines cause a compilation error, fromString and asString are not suitable matches. I couldn't see any obvious utility for mapping between JSON and PVector<T>.

Fixed both, thanks.