Class ConstructorCache

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

public final class ConstructorCache extends Object
A cache that stores classes and exposes a method to retrieve its zero-argument constructor.

This cache stores weak references to loaded classes, allowing them to be garbage collected at any point.

Classes are loaded by first attempting to load it via the thread context ClassLoader (or system ClassLoader if the calling thread does not have one). If that fails, it will attempt using the ClassLoader that loaded ClassLoaderHelper.

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

See Also:
  • 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.