Browse Source

Polishing.

Tweak wording.

See #2794
Original pull request: #2794
3.0.x
Mark Paluch 3 years ago
parent
commit
5d293c48c3
No known key found for this signature in database
GPG Key ID: 4406B84C1661DCD1
  1. 6
      src/main/asciidoc/repository-projections.adoc

6
src/main/asciidoc/repository-projections.adoc

@ -235,14 +235,16 @@ The following example shows a projecting DTO: @@ -235,14 +235,16 @@ The following example shows a projecting DTO:
.A projecting DTO
====
[source, java]
[source,java]
----
record NamesOnly(String firstname, String lastname) {
}
----
====
Records are ideal DTOs since they adhere to value semantics (all fields are private final, `equals(…)` and `hashCode()` are provided by default), but you are free to use any class with a constructor listing the fields to be retrieved.
Java Records are ideal to define DTO types since they adhere to value semantics:
All fields are `private final` and ``equals(…)``/``hashCode()``/``toString()`` methods are created automatically.
Alternatively, you can use any class that defines the properties you want to project.
ifdef::repository-projections-trailing-dto-fragment[]
include::{repository-projections-trailing-dto-fragment}[]

Loading…
Cancel
Save