Interface ClassMetadataProviderFactory<MethodKey>

Type Parameters:
MethodKey - The type of the method key, representing a unique identifier for methods. Can be whatever it needs to be.
All Known Implementing Classes:
ReflectionBasedClassMetadataProviderFactory

public interface ClassMetadataProviderFactory<MethodKey>
A factory interface for providing access to class metadata. Intended to be implemented by downstream frameworks.

dev.langchain4j.classinstance.ReflectionBasedClassMetadataProviderFactory provides an implementation that uses reflection, which is probably fine in most cases, but this provides hooks for other frameworks (like Quarkus) which don't use reflection to provide class metadata.

  • Method Details

    • getAnnotation

      <T extends Annotation> Optional<T> getAnnotation(MethodKey method, Class<T> annotationClass)
      Retrieves an annotation of the specified type from the given method.
      Type Parameters:
      T - The type of the annotation to locate, which must extend Annotation.
      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 Optional containing the located annotation, or an empty Optional if the annotation is not present on the specified method.
    • getAnnotation

      <T extends Annotation> Optional<T> getAnnotation(Class<?> clazz, Class<T> annotationClass)
      Retrieves an annotation of the specified type from the given class.
      Type Parameters:
      T - The type of the annotation to locate, which must extend Annotation.
      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 Optional containing the located annotation, or an empty Optional if the annotation is not present on the specified class.
    • getNonStaticMethodsOnClass

      Iterable<MethodKey> getNonStaticMethodsOnClass(Class<?> clazz)
      Retrieves an iterable containing method keys for all non-static methods defined in the specified class.
      Parameters:
      clazz - The class from which to retrieve methods.
      Returns:
      An iterable of method keys corresponding to the methods of the specified class.