-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
97 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
src/main/java/fr/kazejiyu/generic/datatable/core/impl/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 54 additions & 1 deletion
55
src/main/java/fr/kazejiyu/generic/datatable/core/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,59 @@ | ||
/** | ||
* Describes a Table data structure.. | ||
* Describes a Table data structure. | ||
* | ||
* <h3>ColumnId</h3> | ||
* | ||
* The term <em>id</em> refers to instances of {@link fr.kazejiyu.generic.datatable.core.impl.ColumnId ColumnId}. <br> | ||
* An id is a trick used to reference a table's column in a type-safe way and can be created with the | ||
* {@link fr.kazejiyu.generic.datatable.core.impl.ColumnId#id(String, Class) ColumnId.id(String,Class)} static method. <br> | ||
* <br> | ||
* For instance, the following id references any column which name is "age" and which stores integers: <br> | ||
* <br> | ||
* {@code ColumnId<Integer> age = id("name", Integer.class);} | ||
* | ||
* <h3>Populating a Table</h3> | ||
* | ||
* Creation of a new {@link fr.kazejiyu.generic.datatable.core.Table Table} consists of an easy one-liner : <br> | ||
* <br> | ||
* {@code Table people = new DataTable();} <br> | ||
* <br> | ||
* A table can be filled either by adding new columns : | ||
* | ||
* <pre>people.columns() | ||
* .create("Name", String.class, "Luc", "Baptiste", "Marie") | ||
* .create("Age", Integer.class, 23, 32, 42);}</pre> | ||
* | ||
* or by adding new rows : | ||
* | ||
* <pre>people.rows() | ||
* .create("Julie", 12) | ||
* .create("Mathieu", 67);</pre> | ||
* | ||
* <h3>Depopulating a Table</h3> | ||
* | ||
* A table can be emptied either by removing columns: | ||
* | ||
* <pre>people.columns() | ||
* .remove("age");</pre> | ||
* | ||
* <h3>Querying a Table</h3> | ||
* | ||
* The {@link Table#filter(ca.odell.glazedlists.matchers.Matcher) Table.filter(Matcher)} makes easy to retrieve | ||
* the rows of a table that match a specific criterion: | ||
* | ||
* <pre>ColumnId<Integer> AGE = id(Integer.class, "age"); | ||
*ColumnId<String> NAME = id(String.class, "name"); | ||
* | ||
*Table adultsWhoseNameEndsWithLetterE(Table people) { | ||
* return people.filter(row -> | ||
* row.get(AGE) > 18 && | ||
* row.get(NAME).startsWith("E") | ||
* ); | ||
*}</pre> | ||
* | ||
* For more complex cases, the API also defines a SQL-like DSL that makes possible to apply a same filter on mutliple | ||
* columns. See {@link fr.kazejiyu.generic.datatable.query} for an overview. | ||
* | ||
* @author Emmanuel CHEBBI | ||
*/ | ||
package fr.kazejiyu.generic.datatable.core; |
2 changes: 1 addition & 1 deletion
2
src/main/java/fr/kazejiyu/generic/datatable/query/impl/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/fr/kazejiyu/generic/datatable/query/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* Describes a SQL-like DSL to query the content of a {@link fr.kazejiyu.generic.datatable.core.Table Table}. | ||
* | ||
* <h3>SQL-like DSL</h3> | ||
* | ||
* The API can be used as follows: | ||
* | ||
* <pre>ColumnId<Integer> AGE = id(Integer.class, "age"); | ||
*ColumnId<String> NAME = id(String.class, "name"); | ||
*ColumnId<String> SURENAME = id(String.class, "surename"); | ||
* | ||
*Table europeanAdultsWhoseNameEndsWithLetterE(Table people) { | ||
* return Query | ||
* .from(people) | ||
* .where(s(NAME, SURENAME)).endsWith("e") | ||
* .and(AGE).gt(18) | ||
* .and(COUNTRY).match(Country::isInEurope) | ||
* .select(); | ||
*}</pre> | ||
* | ||
* @author Emmanuel CHEBBI | ||
*/ | ||
package fr.kazejiyu.generic.datatable.query; |