You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now imagine that we want to retrieve the person's name attributes only.
37
-
What means does Spring Data offer to achieve this?The rest of this chapter answers that question.
37
+
What means does Spring Data offer to achieve this?The rest of this chapter answers that question.
38
38
39
39
[[projections.interfaces]]
40
40
== Interface-based Projections
@@ -264,17 +264,22 @@ class NamesOnly {
264
264
You can dramatically simplify the code for a DTO by using https://projectlombok.org[Project Lombok], which provides an `@Value` annotation (not to be confused with Spring's `@Value` annotation shown in the earlier interface examples).
265
265
If you use Project Lombok's `@Value` annotation, the sample DTO shown earlier would become the following:
266
266
267
-
[source,java]
267
+
[source,java]
268
268
----
269
269
@Value
270
270
class NamesOnly {
271
271
String firstname, lastname;
272
272
}
273
273
----
274
+
274
275
Fields are `private final` by default, and the class exposes a constructor that takes all fields and automatically gets `equals(…)` and `hashCode()` methods implemented.
0 commit comments