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

https://github.com/lbovet/super-machine

Query Java object graphs in a typed and streamed fashion
https://github.com/lbovet/super-machine

graph object stream traversal

Last synced: 13 days ago
JSON representation

Query Java object graphs in a typed and streamed fashion

Awesome Lists containing this project

README

        

# super-machine
Query Java object graphs in a typed and streamed fashion

[![Build Status](https://travis-ci.org/lbovet/super-machine.svg?branch=master)](https://travis-ci.org/lbovet/super-machine)

A swisspush project

What about:

```java
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?