Skip to content
/ tojos Public

Text Object Java Objects (TOJOs): an object representation of a multi-line structured text file like CSV, YAML, or JSON

License

Notifications You must be signed in to change notification settings

yegor256/tojos

Repository files navigation

NoSQL Single-File Database

EO principles respected here DevOps By Rultor.com We recommend IntelliJ IDEA

mvn PDD status Maintainability Maven Central Javadoc codecov Hits-of-Code License

It's a simple manager of "records" in a text file of CSV, JSON, etc. format. It's something you would use when you don't want to run a full database, but just a list of lines in a file is not enough. You need a file with structured records.

You add this to your pom.xml:

<dependency>
  <groupId>com.yegor256</groupId>
  <artifactId>tojos</artifactId>
  <version>0.18.2</version>
</dependency>

Then, to manage books.csv file:

import com.yegor256.tojos.MnCsv;
import com.yegor256.tojos.TjDefault;
import com.yegor256.tojos.Tojo;
import com.yegor256.tojos.Tojos;

Tojos tojos = new TjDefault(new MnCsv("books.csv"));
Tojo t1 = tojos.add("Object Thinking"); // unique ID
t1.set("author", "David West");
Tojo t2 = tojos.select(
    t -> t.get("author").equals("David West")
).get(0);

Each record has a unique ID, which is also the first column.

How to Contribute

Fork repository, make changes, send us a pull request. We will review your changes and apply them to the master branch shortly, provided they don't violate our quality standards. To avoid frustration, before sending us your pull request please run full Maven build:

mvn clean install -Pqulice

You will need Maven 3.3+ and Java 8+.