Class FallbackClassDefiner
java.lang.Object
eu.cloudnetservice.driver.util.define.FallbackClassDefiner
- All Implemented Interfaces:
ClassDefiner
A class definer which defines classes using a class loader. This is a fallback method which will not work as expected
on modern jvm implementations which have higher access check requirements. In normal cases this definer should never
get used as the
LookupClassDefiner should define classes.- Since:
- 4.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classA class loader which gives access to the normally protected defineClass method. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final com.github.benmanes.caffeine.cache.LoadingCache<ClassLoader,FallbackClassDefiner.DefiningClassLoader> The cached defining class loaders for each class loader of the parent classes to define the class in. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
cache
private final com.github.benmanes.caffeine.cache.LoadingCache<ClassLoader,FallbackClassDefiner.DefiningClassLoader> cacheThe cached defining class loaders for each class loader of the parent classes to define the class in.
-
-
Constructor Details
-
FallbackClassDefiner
FallbackClassDefiner()
-
-
Method Details
-
defineClass
@NonNull public @NonNull Class<?> defineClass(@NonNull @NonNull String name, @NonNull @NonNull Class<?> parent, byte[] bytecode) Defines the given class bytecode and return the constructed class object.- Specified by:
defineClassin interfaceClassDefiner- Parameters:
name- the name of the class to construct.parent- the parent class of this class as we are assuming to define an anonymous class.bytecode- the bytecode of the class to define.- Returns:
- the constructed class object from the given bytecode.
-