Class ReflectionBasedClassMetadataProviderFactory
java.lang.Object
dev.langchain4j.classloading.ReflectionBasedClassMetadataProviderFactory
- All Implemented Interfaces:
ClassMetadataProviderFactory<Method>
public final class ReflectionBasedClassMetadataProviderFactory
extends Object
implements ClassMetadataProviderFactory<Method>
Implementation of the
ClassMetadataProviderFactory interface using Java Reflection.
This class provides methods to retrieve annotations and method metadata from classes
via reflection-based mechanisms.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends Annotation>
Optional<T> getAnnotation(Class<?> clazz, Class<T> annotationClass) Retrieves an annotation of the specified type from the given class.<T extends Annotation>
Optional<T> getAnnotation(Method method, Class<T> annotationClass) Retrieves an annotation of the specified type from the given method.getNonStaticMethodsOnClass(Class<?> clazz) Retrieves an iterable containing method keys for all non-static methods defined in the specified class.
-
Constructor Details
-
ReflectionBasedClassMetadataProviderFactory
public ReflectionBasedClassMetadataProviderFactory()
-
-
Method Details
-
getAnnotation
Description copied from interface:ClassMetadataProviderFactoryRetrieves an annotation of the specified type from the given method.- Specified by:
getAnnotationin interfaceClassMetadataProviderFactory<Method>- Type Parameters:
T- The type of the annotation to locate, which must extendAnnotation.- Parameters:
method- The method from which the annotation is to be retrieved.annotationClass- The class object corresponding to the annotation type to find.- Returns:
- An
Optionalcontaining the located annotation, or an emptyOptionalif the annotation is not present on the specified method.
-
getAnnotation
Description copied from interface:ClassMetadataProviderFactoryRetrieves an annotation of the specified type from the given class.- Specified by:
getAnnotationin interfaceClassMetadataProviderFactory<Method>- Type Parameters:
T- The type of the annotation to locate, which must extendAnnotation.- Parameters:
clazz- The class from which the annotation is to be retrieved.annotationClass- The class object corresponding to the annotation type to find.- Returns:
- An
Optionalcontaining the located annotation, or an emptyOptionalif the annotation is not present on the specified class.
-
getNonStaticMethodsOnClass
Description copied from interface:ClassMetadataProviderFactoryRetrieves an iterable containing method keys for all non-static methods defined in the specified class.- Specified by:
getNonStaticMethodsOnClassin interfaceClassMetadataProviderFactory<Method>- Parameters:
clazz- The class from which to retrieve methods.- Returns:
- An iterable of method keys corresponding to the methods of the specified class.
-