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
- Host: GitHub
- URL: https://github.com/lbovet/super-machine
- Owner: lbovet
- License: apache-2.0
- Created: 2017-06-05T15:03:33.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-08T08:02:46.000Z (almost 8 years ago)
- Last Synced: 2025-04-15T21:48:25.860Z (13 days ago)
- Topics: graph, object, stream, traversal
- Language: Java
- Homepage:
- Size: 27.3 KB
- Stars: 28
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# super-machine
Query Java object graphs in a typed and streamed fashion[](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?