@@ -155,6 +155,7 @@ private static final class ReturnedInterface extends ReturnedType {
155155
156156 private final ProjectionInformation information ;
157157 private final Class <?> domainType ;
158+ private final List <String > inputProperties ;
158159
159160 /**
160161 * Creates a new {@link ReturnedInterface} from the given {@link ProjectionInformation} and domain type.
@@ -170,13 +171,28 @@ public ReturnedInterface(ProjectionInformation information, Class<?> domainType)
170171
171172 this .information = information ;
172173 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 );
173188 }
174189
175190 @ Override
176191 public Class <?> getReturnedType () {
177192 return information .getType ();
178193 }
179194
195+ @ Override
180196 public boolean needsCustomConstruction () {
181197 return isProjecting () && information .isClosed ();
182198 }
@@ -194,16 +210,7 @@ public Class<?> getTypeToRead() {
194210
195211 @ Override
196212 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 ;
207214 }
208215 }
209216
@@ -243,6 +250,7 @@ public Class<?> getReturnedType() {
243250 return type ;
244251 }
245252
253+ @ Override
246254 @ NonNull
247255 public Class <?> getTypeToRead () {
248256 return type ;
@@ -253,6 +261,7 @@ public boolean isProjecting() {
253261 return isDto ();
254262 }
255263
264+ @ Override
256265 public boolean needsCustomConstruction () {
257266 return isDto () && !inputProperties .isEmpty ();
258267 }
@@ -280,7 +289,7 @@ private List<String> detectConstructorParameterNames(Class<?> type) {
280289 properties .add (parameter .getName ());
281290 }
282291
283- return properties ;
292+ return Collections . unmodifiableList ( properties ) ;
284293 }
285294
286295 private boolean isDto () {
0 commit comments