3131
3232import org .springframework .beans .BeanUtils ;
3333import org .springframework .core .log .LogMessage ;
34+ import org .springframework .core .type .AnnotationMetadata ;
3435import org .springframework .core .type .MethodMetadata ;
35- import org .springframework .data .type .MethodsMetadata ;
36- import org .springframework .data .type .classreading .MethodsMetadataReaderFactory ;
36+ import org .springframework .core .type .classreading .SimpleMetadataReaderFactory ;
3737import org .springframework .data .util .StreamUtils ;
3838import org .springframework .util .Assert ;
3939import org .springframework .util .ClassUtils ;
@@ -133,7 +133,7 @@ private static class PropertyDescriptorSource {
133133 private static final Log logger = LogFactory .getLog (PropertyDescriptorSource .class );
134134
135135 private final Class <?> type ;
136- private final Optional <MethodsMetadata > metadata ;
136+ private final Optional <AnnotationMetadata > metadata ;
137137
138138 /**
139139 * Creates a new {@link PropertyDescriptorSource} for the given type.
@@ -179,15 +179,15 @@ private Stream<PropertyDescriptor> collectDescriptors() {
179179 }
180180
181181 /**
182- * Returns a {@link Stream} of {@link PropertyDescriptor} ordered following the given {@link MethodsMetadata} only
183- * returning methods seen by the given {@link MethodsMetadata }.
182+ * Returns a {@link Stream} of {@link PropertyDescriptor} ordered following the given {@link AnnotationMetadata}
183+ * only returning methods seen by the given {@link AnnotationMetadata }.
184184 *
185185 * @param source must not be {@literal null}.
186186 * @param metadata must not be {@literal null}.
187187 * @return
188188 */
189189 private static Stream <PropertyDescriptor > filterAndOrder (Stream <PropertyDescriptor > source ,
190- MethodsMetadata metadata ) {
190+ AnnotationMetadata metadata ) {
191191
192192 var orderedMethods = getMethodOrder (metadata );
193193
@@ -201,12 +201,12 @@ private static Stream<PropertyDescriptor> filterAndOrder(Stream<PropertyDescript
201201 }
202202
203203 /**
204- * Returns a {@link Stream} of interfaces using the given {@link MethodsMetadata } as primary source for ordering.
204+ * Returns a {@link Stream} of interfaces using the given {@link AnnotationMetadata } as primary source for ordering.
205205 *
206206 * @param metadata must not be {@literal null}.
207207 * @return
208208 */
209- private Stream <Class <?>> fromMetadata (MethodsMetadata metadata ) {
209+ private Stream <Class <?>> fromMetadata (AnnotationMetadata metadata ) {
210210 return Arrays .stream (metadata .getInterfaceNames ()).map (it -> findType (it , type .getInterfaces ()));
211211 }
212212
@@ -220,20 +220,20 @@ private Stream<Class<?>> fromType() {
220220 }
221221
222222 /**
223- * Attempts to obtain {@link MethodsMetadata } from {@link Class}. Returns {@link Optional} containing
224- * {@link MethodsMetadata } if metadata was read successfully, {@link Optional#empty()} otherwise.
223+ * Attempts to obtain {@link AnnotationMetadata } from {@link Class}. Returns {@link Optional} containing
224+ * {@link AnnotationMetadata } if metadata was read successfully, {@link Optional#empty()} otherwise.
225225 *
226226 * @param type must not be {@literal null}.
227- * @return the optional {@link MethodsMetadata }.
227+ * @return the optional {@link AnnotationMetadata }.
228228 */
229- private static Optional <MethodsMetadata > getMetadata (Class <?> type ) {
229+ private static Optional <AnnotationMetadata > getMetadata (Class <?> type ) {
230230
231231 try {
232232
233- var factory = new MethodsMetadataReaderFactory (type .getClassLoader ());
233+ var factory = new SimpleMetadataReaderFactory (type .getClassLoader ());
234234 var metadataReader = factory .getMetadataReader (ClassUtils .getQualifiedName (type ));
235235
236- return Optional .of (metadataReader .getMethodsMetadata ());
236+ return Optional .of (metadataReader .getAnnotationMetadata ());
237237
238238 } catch (IOException e ) {
239239
@@ -259,18 +259,18 @@ private static Class<?> findType(String name, Class<?>[] types) {
259259 }
260260
261261 /**
262- * Returns a {@link Map} containing method name to its positional index according to {@link MethodsMetadata }.
262+ * Returns a {@link Map} containing method name to its positional index according to {@link AnnotationMetadata }.
263263 *
264264 * @param metadata
265265 * @return
266266 */
267- private static Map <String , Integer > getMethodOrder (MethodsMetadata metadata ) {
267+ private static Map <String , Integer > getMethodOrder (AnnotationMetadata metadata ) {
268268
269- var methods = metadata .getMethods () //
269+ var methods = metadata .getDeclaredMethods () //
270270 .stream () //
271271 .map (MethodMetadata ::getMethodName ) //
272272 .distinct () //
273- .collect ( Collectors . toList () );
273+ .toList ();
274274
275275 return IntStream .range (0 , methods .size ()) //
276276 .boxed () //
0 commit comments