@FunctionalInterface public interface ClassHierarchyResolver
| Modifier and Type | Interface | Description |
|---|---|---|
static interface |
ClassHierarchyResolver.ClassHierarchyInfo |
Information about a resolved class. |
| Modifier and Type | Method | Description |
|---|---|---|
default ClassHierarchyResolver |
cached() |
Returns a ClassHierarchyResolver that caches class hierarchy information from this resolver. |
default ClassHierarchyResolver |
cached |
Returns a ClassHierarchyResolver that caches class hierarchy information from this resolver. |
static ClassHierarchyResolver |
defaultResolver() |
Returns the default instance of ClassHierarchyResolver that gets ClassHierarchyResolver.ClassHierarchyInfo from system class loader with reflection. |
ClassHierarchyResolver.ClassHierarchyInfo |
getClassInfo |
Returns the ClassHierarchyInfo for a given class name, or
null if the name is unknown to the resolver. |
static ClassHierarchyResolver |
of |
Returns a ClassHierarchyResolver that extracts class hierarchy information from collections of class hierarchy metadata. |
static ClassHierarchyResolver |
ofClassLoading |
Returns a ClassHierarchyResolver that extracts class hierarchy information via classes loaded by a class loader with reflection. |
static ClassHierarchyResolver |
ofClassLoading |
Returns a ClassHierarchyResolver that extracts class hierarchy information via classes accessible to a MethodHandles.Lookup with reflection. |
static ClassHierarchyResolver |
ofResourceParsing |
Returns a ClassHierarchyResolver that extracts class hierarchy information from class files located by a class loader. |
static ClassHierarchyResolver |
ofResourceParsing |
Returns a ClassHierarchyResolver that extracts class hierarchy information from class files returned by a mapping function. |
default ClassHierarchyResolver |
orElse |
Chains this ClassHierarchyResolver with another to be consulted if this resolver does not know about the specified class. |
static ClassHierarchyResolver defaultResolver()
ClassHierarchyResolver that gets ClassHierarchyResolver.ClassHierarchyInfo from system class loader with reflection. This default instance cannot load classes from other class loaders, such as the caller's class loader; it also loads the system classes if they are not yet loaded, which makes it unsuitable for instrumentation.ClassHierarchyResolver that gets ClassHierarchyResolver.ClassHierarchyInfo from system class loader with reflectionClassHierarchyResolver.ClassHierarchyInfo getClassInfo(ClassDesc classDesc)
ClassHierarchyInfo for a given class name, or
null if the name is unknown to the resolver. This method is called by the Class-File API to obtain the hierarchy information of a class or interface; users should not call this method. The symbolic descriptor passed by the Class-File API always represents a class or interface.
classDesc - descriptor of the classClassHierarchyInfo for a given class name, or
null if the name is unknown to the resolverIllegalArgumentException - if a class shouldn't be queried for hierarchy, such as when it is inaccessibledefault ClassHierarchyResolver orElse(ClassHierarchyResolver other)
ClassHierarchyResolver with another to be consulted if this resolver does not know about the specified class.
other resolver in case this resolver returns null.other - the other resolverdefault ClassHierarchyResolver cached(Supplier<Map<ClassDesc, ClassHierarchyResolver.ClassHierarchyInfo>> cacheFactory)
ClassHierarchyResolver that caches class hierarchy information from this resolver. The returned resolver will not update if the query results from this resolver changed over time. The thread safety of the returned resolver depends on the thread safety of the map returned by the cacheFactory.cacheFactory. It looks up in the cache map, or if a class name has not yet been queried, queries this resolver and caches the result, including a null that indicates unknown class names. The cache map may refuse null keys and values.cacheFactory - the factory for the cacheClassHierarchyResolver that caches class hierarchy information from this resolverdefault ClassHierarchyResolver cached()
ClassHierarchyResolver that caches class hierarchy information from this resolver. The returned resolver will not update if the query results from this resolver changed over time. The returned resolver is not thread-safe. MethodHandles.Lookup lookup = ...;
ClassHierarchyResolver resolver = ClassHierarchyResolver.ofClassLoading(lookup).cached();
cached(Supplier) with HashMap supplier as cacheFactory.ClassHierarchyResolver that caches class hierarchy information from this resolverstatic ClassHierarchyResolver ofResourceParsing(Function<ClassDesc, InputStream> classStreamResolver)
ClassHierarchyResolver that extracts class hierarchy information from class files returned by a mapping function. The mapping function should return null if it cannot provide a class file for a class name. Any IOException from the provided input stream is rethrown as an UncheckedIOException in getClassInfo(ClassDesc).classStreamResolver - maps class descriptors to class file input streamsClassHierarchyResolver that extracts class hierarchy information from class files returned by a mapping functionstatic ClassHierarchyResolver ofResourceParsing(ClassLoader loader)
ClassHierarchyResolver that extracts class hierarchy information from class files located by a class loader.loader - the class loader, to find class filesClassHierarchyResolver that extracts class hierarchy information from class files located by a class loaderstatic ClassHierarchyResolver of(Collection<ClassDesc> interfaces, Map<ClassDesc, ClassDesc> classToSuperClass)
ClassHierarchyResolver that extracts class hierarchy information from collections of class hierarchy metadata.interfaces - a collection of classes known to be interfacesclassToSuperClass - a map from classes to their super classesClassHierarchyResolver that extracts class hierarchy information from collections of class hierarchy metadatastatic ClassHierarchyResolver ofClassLoading(ClassLoader loader)
ClassHierarchyResolver that extracts class hierarchy information via classes loaded by a class loader with reflection.loader - the class loaderClassHierarchyResolver that extracts class hierarchy information via classes loaded by a class loader with reflectionstatic ClassHierarchyResolver ofClassLoading(MethodHandles.Lookup lookup)
ClassHierarchyResolver that extracts class hierarchy information via classes accessible to a MethodHandles.Lookup with reflection. If the class resolved is inaccessible to the given lookup, getClassInfo(ClassDesc) throws IllegalArgumentException instead of returning null.lookup - the lookup, must be able to access classes to resolveClassHierarchyResolver that extracts class hierarchy information via classes accessible to a MethodHandles.Lookup with reflection
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/classfile/ClassHierarchyResolver.html