Skip to content

Commit a3a028f

Browse files
anidotnetCopilot
andauthored
Update nitrite/src/main/java/org/dizitart/no2/repository/Reflector.java
Co-authored-by: Copilot <[email protected]>
1 parent 98b6e83 commit a3a028f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

nitrite/src/main/java/org/dizitart/no2/repository/Reflector.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,12 @@ private <T> Field getFieldFromInterfaceProperty(Class<T> interfaceType, String p
207207
*/
208208
private Field createSyntheticFieldForProperty(String propertyName, Method getterMethod) {
209209
try {
210-
// Use a generic Object field as a template
211-
// The name won't match but the infrastructure can work around it
210+
// Use a generic Object field as a template.
211+
// The field name ("property") does not match the actual property name,
212+
// but InterfacePropertyHolder.registerProperty stores the mapping between
213+
// the template field, the actual property name, and the getter method.
214+
// This allows the infrastructure to later retrieve the correct property
215+
// information for interface-based repositories, even though the field name is generic.
212216
Field templateField = InterfacePropertyHolder.class.getDeclaredField("property");
213217
// Store metadata about this field for later use
214218
InterfacePropertyHolder.registerProperty(templateField, propertyName, getterMethod);

0 commit comments

Comments
 (0)