@@ -155,6 +155,7 @@ private static final class ReturnedInterface extends ReturnedType {
155
155
156
156
private final ProjectionInformation information ;
157
157
private final Class <?> domainType ;
158
+ private final List <String > inputProperties ;
158
159
159
160
/**
160
161
* Creates a new {@link ReturnedInterface} from the given {@link ProjectionInformation} and domain type.
@@ -170,13 +171,28 @@ public ReturnedInterface(ProjectionInformation information, Class<?> domainType)
170
171
171
172
this .information = information ;
172
173
this .domainType = domainType ;
174
+ this .inputProperties = detectInputProperties (information );
175
+ }
176
+
177
+ private static List <String > detectInputProperties (ProjectionInformation information ) {
178
+
179
+ List <String > properties = new ArrayList <>();
180
+
181
+ for (PropertyDescriptor descriptor : information .getInputProperties ()) {
182
+ if (!properties .contains (descriptor .getName ())) {
183
+ properties .add (descriptor .getName ());
184
+ }
185
+ }
186
+
187
+ return Collections .unmodifiableList (properties );
173
188
}
174
189
175
190
@ Override
176
191
public Class <?> getReturnedType () {
177
192
return information .getType ();
178
193
}
179
194
195
+ @ Override
180
196
public boolean needsCustomConstruction () {
181
197
return isProjecting () && information .isClosed ();
182
198
}
@@ -194,16 +210,7 @@ public Class<?> getTypeToRead() {
194
210
195
211
@ Override
196
212
public List <String > getInputProperties () {
197
-
198
- List <String > properties = new ArrayList <>();
199
-
200
- for (PropertyDescriptor descriptor : information .getInputProperties ()) {
201
- if (!properties .contains (descriptor .getName ())) {
202
- properties .add (descriptor .getName ());
203
- }
204
- }
205
-
206
- return properties ;
213
+ return inputProperties ;
207
214
}
208
215
}
209
216
@@ -243,6 +250,7 @@ public Class<?> getReturnedType() {
243
250
return type ;
244
251
}
245
252
253
+ @ Override
246
254
@ NonNull
247
255
public Class <?> getTypeToRead () {
248
256
return type ;
@@ -253,6 +261,7 @@ public boolean isProjecting() {
253
261
return isDto ();
254
262
}
255
263
264
+ @ Override
256
265
public boolean needsCustomConstruction () {
257
266
return isDto () && !inputProperties .isEmpty ();
258
267
}
@@ -280,7 +289,7 @@ private List<String> detectConstructorParameterNames(Class<?> type) {
280
289
properties .add (parameter .getName ());
281
290
}
282
291
283
- return properties ;
292
+ return Collections . unmodifiableList ( properties ) ;
284
293
}
285
294
286
295
private boolean isDto () {
0 commit comments