@@ -143,6 +143,7 @@ private static final class ReturnedInterface extends ReturnedType {
143143
144144 private final ProjectionInformation information ;
145145 private final Class <?> domainType ;
146+ private final List <String > inputProperties ;
146147
147148 /**
148149 * Creates a new {@link ReturnedInterface} from the given {@link ProjectionInformation} and domain type.
@@ -158,13 +159,28 @@ public ReturnedInterface(ProjectionInformation information, Class<?> domainType)
158159
159160 this .information = information ;
160161 this .domainType = domainType ;
162+ this .inputProperties = detectInputProperties (information );
163+ }
164+
165+ private static List <String > detectInputProperties (ProjectionInformation information ) {
166+
167+ List <String > properties = new ArrayList <>();
168+
169+ for (PropertyDescriptor descriptor : information .getInputProperties ()) {
170+ if (!properties .contains (descriptor .getName ())) {
171+ properties .add (descriptor .getName ());
172+ }
173+ }
174+
175+ return Collections .unmodifiableList (properties );
161176 }
162177
163178 @ Override
164179 public Class <?> getReturnedType () {
165180 return information .getType ();
166181 }
167182
183+ @ Override
168184 public boolean needsCustomConstruction () {
169185 return isProjecting () && information .isClosed ();
170186 }
@@ -182,16 +198,7 @@ public Class<?> getTypeToRead() {
182198
183199 @ Override
184200 public List <String > getInputProperties () {
185-
186- List <String > properties = new ArrayList <>();
187-
188- for (PropertyDescriptor descriptor : information .getInputProperties ()) {
189- if (!properties .contains (descriptor .getName ())) {
190- properties .add (descriptor .getName ());
191- }
192- }
193-
194- return properties ;
201+ return inputProperties ;
195202 }
196203 }
197204
@@ -231,6 +238,7 @@ public Class<?> getReturnedType() {
231238 return type ;
232239 }
233240
241+ @ Override
234242 @ NonNull
235243 public Class <?> getTypeToRead () {
236244 return type ;
@@ -241,6 +249,7 @@ public boolean isProjecting() {
241249 return isDto ();
242250 }
243251
252+ @ Override
244253 public boolean needsCustomConstruction () {
245254 return isDto () && !inputProperties .isEmpty ();
246255 }
@@ -268,7 +277,7 @@ private List<String> detectConstructorParameterNames(Class<?> type) {
268277 properties .add (parameter .getName ());
269278 }
270279
271- return properties ;
280+ return Collections . unmodifiableList ( properties ) ;
272281 }
273282
274283 private boolean isDto () {
0 commit comments