Skip to content

Query Java object graphs in a typed and streamed fashion

License

Notifications You must be signed in to change notification settings

swisspost/super-machine

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A swisspost project

super-machine

Query Java object graphs in a typed and streamed fashion

Build Status

What about:

from(invoice).
  .find(Article.class)
  .filter(article -> article.getType().equals("hardware")
  .extract(Article::getVendor)
  .filter(vendor -> !vendor.getName().equals("Apple")
  .find(Office.class)
  .then( 
    (offices -> offices.extract(Office::getCity)),
    (offices -> offices.find(Person.class).extract(Person::getFullName)))
  .stream()

Returns the name of employees and city name of the offices of non-Apple vendors that sells hardware article on this invoice.

find traverses the object graph to find all occurences in properties, maps and collections. In the example above, the structure could be:

Invoice
   |
   | *
 Lines  --- Article
               | *
               |
             Vendor
               | *
               |
            Company
               |
               | *
             Office --- Staff --- * Employee --- Person

Nice?

About

Query Java object graphs in a typed and streamed fashion

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%