Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6e033ca

Browse files
committed
Add nomenculature documentation (Backend / Repository etc.)
1 parent7ecb424 commit6e033ca

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

‎criteria/README.md‎

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ PersonCriteria.person.id.isIn("id1", "id2", "id3");
3434
// query on Strings, Comparables and Optionals
3535
person
3636
.fullName.startsWith("John")// basic string conditions
37-
.fullName.isEqualTo(3.1415D)// will not compile since fullName is String
37+
.fullName.isEqualTo(3.1415D)//ERROR!will not compile since fullName is String (not double)
3838
.nickName.isAbsent()// for Optional attribute
3939
.or()// disjunction
4040
.age.isGreaterThan(21)
@@ -62,7 +62,7 @@ person.fullName.isEqualTo("John").and(person.age.isGreaterThan(22).or().nickName
6262
Not all entities require repository (`@Criteria.Repository`) but you need to add`@Criteria` to all classes you want to query by. For example, to filter on`Person.pets.name``Pet` class needs to have`@Criteria` (otherwise`PersonCriteria.pets` will have a very generic Object matcher).
6363

6464
####Use generated repository to query or update a datasource
65-
`@Criteria.Repository` instructs immutables to generate repository class with`find` /`insert` /`watch` operations. You are required to provide a valid[backend](https://github.com/immutables/immutables/blob/master/criteria/common/src/org/immutables/criteria/adapter/Backend.java)
65+
`@Criteria.Repository` instructs immutables to generate repository class with`find` /`insert` /`watch` operations. You are required to provide a valid[backend](https://github.com/immutables/immutables/blob/master/criteria/common/src/org/immutables/criteria/backend/Backend.java)
6666
instance (mongo, elastic, inmemory etc).
6767

6868
```java
@@ -78,8 +78,27 @@ repository.insert(ImmutablePerson.builder().id("aaa").fullName("John Smith").age
7878
Publisher<Person> result= repository.find(person.fullName.contains("Smith")).fetch();
7979
```
8080

81+
###Building blocks (nomenclature)
82+
-**Matcher** Typed predicate on a particular attribute. There are several variations of the matcher and, usually, they're
83+
associated with a type (eg.
84+
[StringMatcher](https://github.com/immutables/immutables/blob/master/criteria/common/src/org/immutables/criteria/matcher/StringMatcher.java),
85+
[IterableMatcher](https://github.com/immutables/immutables/blob/master/criteria/common/src/org/immutables/criteria/matcher/IterableMatcher.java),
86+
[ComparableMatcher](https://github.com/immutables/immutables/blob/master/criteria/common/src/org/immutables/criteria/matcher/ComparableMatcher.java)).
87+
Matcher internally builds an_Expression_.
88+
-**Expression** Abstraction of a generic expression modeled as
89+
[Abstract Syntax Tree](https://en.wikipedia.org/wiki/Abstract_syntax_tree). Used internally as Intermediate Representation (IR)
90+
to transform original expression into a native query of a database. Users rarely have to deal with this API unless
91+
they write adapters for a particular backend.
92+
-**Backend** adapter to a data-source (database). Responsible for interpreting expressions and operations into native
93+
queries and API calls using vendor drivers.
94+
-**Repository** User facing API to perform queries, updates, pub/sub or other CRUD operations. Uses_Backend_.
95+
-**Facet** Property of repository to fine-tune its behaviour. Eg.`Readable` /`Writable` /`Watchable`
96+
Also one can define return types based on[rxjava](https://github.com/ReactiveX/RxJava) /
97+
async ([CompletionStage](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletionStage.html))
98+
or synchronous types.
99+
81100
###Development
82-
`common` module contains runtime support. Remaining folders are backend implementation.
101+
`common` module contains runtime support. Remaining folders are backendand facetimplementation.
83102

84103
This folder contains classes specific to Criteria API and its runtime evaluation:
85104

@@ -88,6 +107,7 @@ This folder contains classes specific to Criteria API and its runtime evaluation
88107
3.`mongo` adapter for[MongoDB](https://www.mongodb.com/)
89108
based on[reactive streams](https://mongodb.github.io/mongo-java-driver-reactivestreams/) driver.
90109
4.`geode` adapter for[Apache Geode](https://geode.apache.org)
91-
5.`inmemory` lightweight implementation of a backend based on existing Map
110+
5.`inmemory` lightweight implementation of a backend based on existing Map.
111+
6.`rxjava`[rxjava](https://github.com/ReactiveX/RxJava) repository facets.
92112

93113
Criteria API requires Java 8 (or later)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp