Class ConstructorCache

java.lang.Object
software.amazon.awssdk.checksums.internal.ConstructorCache

public final class ConstructorCache extends Object
A cache that stores classes and their constructors by class name and class loader.

This cache uses weak references to both class loaders and classes, allowing them to be garbage collected when no longer needed. It provides methods to retrieve the zero-argument constructor for a class, based on the current thread's context class loader or the system class loader.

If a class or its zero-argument constructor cannot be found, an empty result is returned.

  • Constructor Details

    • ConstructorCache

      public ConstructorCache()
  • Method Details

    • getConstructor

      public Optional<Constructor<?>> getConstructor(String className)
      Retrieve the zero-argument constructor for the given class name. Returns an empty result if no such constructor is found.