Class Discovery

java.lang.Object
com.chemaxon.apidiscovery.Discovery

@Beta @PublicAPI @Deprecated(forRemoval=true) @SubjectToRemoval(date=JAN_01_2025) public final class Discovery extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
The API discovery tool will be removed.
Utility methods for parameter discovery.

Please note that this class is marked with Beta annotation, so it can be subject of incompatible changes or removal in later releases.

  • Method Details

    • listInstances

      @Beta public static <T> List<InstanceWrapper<T>> listInstances(Class<T> type)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Collect instances of a specific type.
      Type Parameters:
      T - Type to collect
      Parameters:
      type - Type to collect
      Returns:
      One or more instances of the specified type. Interfaces are retrieved as services; classes are instantiated with their nullary constructors; enums are enumerated
    • selectInstance

      public static <T> Optional<InstanceWrapper<T>> selectInstance(Class<T> type, String shortName)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Look up an instance by its short name.
      Type Parameters:
      T - Type to collect
      Parameters:
      type - Type to collect (by listInstances(java.lang.Class)
      shortName - Short name of the instance to select
      Returns:
      The first matching instance if found
    • isParametrized

      @Beta public static boolean isParametrized(Object o)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Check if an object is parametrized.
      Parameters:
      o - Object in question
      Returns:
      true if o is parametrized
    • listParameters

      @Beta public static List<ParameterWrapper> listParameters(Object o)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Retrieve parameters for a mutable parameter object.

      Parameter set mode is specified by Parametrized.parameterSetMode() on the objects Parametrized annotation.

      Parameters:
      o - Mutable parametrized object annotated with Parametrized
      Returns:
      Parameters of o wrapped
      Throws:
      IllegalArgumentException - when o is not annotated with Parametrized or no parameters found
    • getAnnotationForClass

      @Beta public static <T extends Annotation> T getAnnotationForClass(Class<T> annotationClass, Class<?> clazz)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Retrieve annotation for a class.

      Note that enum constants are not handled by this method.

      Type Parameters:
      T - Annotation class
      Parameters:
      annotationClass - Annotation class
      clazz - Target class
      Returns:
      Annotation retrieved
      Throws:
      IllegalArgumentException - when no Description annotation found
    • getAnnotationIfPresent

      @Beta public static <T extends Annotation> Optional<T> getAnnotationIfPresent(Class<T> a, Object o)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Retrieve an annotation on an object if present.
      Type Parameters:
      T - Annotation class
      Parameters:
      a - Annotation class
      o - Object to examine
      Returns:
      The description annotation if exist
    • getAnnotation

      @Beta public static <T extends Annotation> T getAnnotation(Class<T> a, Object o)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Retrieve an annotation on an object.
      Type Parameters:
      T - Annotation class
      Parameters:
      a - Annotation class
      o - Object to examine
      Returns:
      The annotation if exists or null; If o is an instance of an enum then enum constant annotation is retrieved
      Throws:
      IllegalArgumentException - when no annotation found
    • getDescriptionAnnotation

      @Beta public static Description getDescriptionAnnotation(Object o)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Retrieve the description annotation on an object.
      Parameters:
      o - Object to examine
      Returns:
      The description annotation if exists or null; If o is an instance of an enum then enum constant annotation is retrieved
      Throws:
      IllegalArgumentException - when no Description annotation found
    • listCreators

      @Beta public static <T> List<CreatorWrapper<T>> listCreators(Object o, Class<T> targetType)
      Deprecated, for removal: This API element is subject to removal in a future version.
      CreatorWrapper acts as a type-dependent service loader.

      Note that the order of the returned list is defined by

      Type Parameters:
      T - type to be created
      Parameters:
      targetType - type to be created
      o - Instance on which the creators should be called
      Returns:
      All distinct creator parameters
    • initializeBuilderIfExists

      @Beta public static <T> Optional<ParameterBuilder<T>> initializeBuilderIfExists(T o)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Create initial Builder if possible.

      Builder association is identified by annotation BuilderClass

      Type Parameters:
      T - Parameter object type
      Parameters:
      o - An object
      Returns:
      An associated builder instance if the parameter object has associated builder.