Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 787 Bytes

README.md

File metadata and controls

43 lines (30 loc) · 787 Bytes

persistence-engine

The Persistence engine is an attempt to define a new way to persist java object.

Concepts

  • Only one instance per entity per VM.
  • Linear entity navigation and query.

Coding

Define entities

public interface Library {

  void setAddress(String address);
  String getAddress();

  Iterable<Book> getBooks();
  void addToBooks(Book book);
  boolean removeFromBooks(Book book);
  int countBooks();
  boolean hasInBooks(Book book);
  
  default Iterable<Book> getBooksByAuthor(String author) {
    return filter(getBooks()).has(book -> book.getAuthor(),author).iterable();
  }
}
public interface Book {

  void setTitle(String title);
  String getTitle();

  void setAuthor(String author);
  String getAuthor();

}