Skip to content

Commit

Permalink
Polishing.
Browse files Browse the repository at this point in the history
Tweak wording.

See #2794
Original pull request: #2794
  • Loading branch information
mp911de committed Mar 20, 2023
1 parent 02ed197 commit 5d293c4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/asciidoc/repository-projections.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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}[]
Expand Down

0 comments on commit 5d293c4

Please sign in to comment.