public interface ClassProvider
extends java.lang.AutoCloseable
| Modifier and Type | Interface and Description |
|---|---|
static interface |
ClassProvider.ClassSupplier |
| Modifier and Type | Method and Description |
|---|---|
default void |
close()
Close the class provider and free all resources.
|
default java.util.Map<java.lang.String,ClassProvider.ClassSupplier> |
getAllClasses()
Get a map of all classes that are available in this provider.
Not every implementation has to support this and can throw an UnsupportedOperationException if it is not supported.The key format is "package/Name". |
byte[] |
getClass(java.lang.String name)
Get the bytecode of a class by its name.
The name should be in the format of "package/Name".If the class could not be found, a ClassNotFoundException is thrown. |
default org.objectweb.asm.tree.ClassNode |
getClassNode(java.lang.String name)
Get the bytecode of a class by its name and convert it to a
ClassNode. |
default ClassProvider |
then(ClassProvider... classProviders)
Delegate all missing classes to the given class providers.
The class providers are checked in the order they are given. See DelegatingClassProvider.getAllClasses() for more information on the behavior of this method.If no class providers are given, the current class provider is returned. |
@Nonnull
byte[] getClass(java.lang.String name)
throws java.lang.ClassNotFoundException
"package/Name".ClassNotFoundException is thrown.name - The name of the classjava.lang.ClassNotFoundException - If the class could not be found@Nonnull default java.util.Map<java.lang.String,ClassProvider.ClassSupplier> getAllClasses() throws java.lang.UnsupportedOperationException
UnsupportedOperationException if it is not supported."package/Name".java.lang.UnsupportedOperationException - If this operation is not supporteddefault void close()
throws java.lang.Exception
close in interface java.lang.AutoCloseablejava.lang.Exception - If an error occurred while closing the class providerdefault org.objectweb.asm.tree.ClassNode getClassNode(java.lang.String name)
throws java.lang.ClassNotFoundException
ClassNode.name - The name of the classjava.lang.ClassNotFoundException - If the class could not be foundgetClass(String)default ClassProvider then(ClassProvider... classProviders)
DelegatingClassProvider.getAllClasses() for more information on the behavior of this method.classProviders - The class providers to delegate toDelegatingClassProvider