Package net.bytebuddy.dynamic
Class ClassFileLocator.PackageDiscriminating
java.lang.Object
net.bytebuddy.dynamic.ClassFileLocator.PackageDiscriminating
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ClassFileLocator
- Enclosing interface:
- ClassFileLocator
@Enhance
public static class ClassFileLocator.PackageDiscriminating
extends Object
implements ClassFileLocator
A class file locator that discriminates by a type's package.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.bytebuddy.dynamic.ClassFileLocator
ClassFileLocator.Compound, ClassFileLocator.ForClassLoader, ClassFileLocator.ForFolder, ClassFileLocator.ForInstrumentation, ClassFileLocator.ForJarFile, ClassFileLocator.ForModule, ClassFileLocator.ForModuleFile, ClassFileLocator.ForUrl, ClassFileLocator.NoOp, ClassFileLocator.PackageDiscriminating, ClassFileLocator.Resolution, ClassFileLocator.Simple
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<String,
ClassFileLocator> A mapping of package names to class file locators.Fields inherited from interface net.bytebuddy.dynamic.ClassFileLocator
CLASS_FILE_EXTENSION
-
Constructor Summary
ConstructorsConstructorDescriptionPackageDiscriminating
(Map<String, ClassFileLocator> classFileLocators) Creates a new package-discriminating class file locator. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Locates the class file for a given type and returns the binary data of the class file.
-
Field Details
-
classFileLocators
A mapping of package names to class file locators.
-
-
Constructor Details
-
PackageDiscriminating
Creates a new package-discriminating class file locator.- Parameters:
classFileLocators
- A mapping of package names to class file locators where an empty string donates the default package.
-
-
Method Details
-
locate
Locates the class file for a given type and returns the binary data of the class file.- Specified by:
locate
in interfaceClassFileLocator
- Parameters:
name
- The name of the type to locate a class file representation for.- Returns:
- Any binary representation of the type which might be illegal.
- Throws:
IOException
- If reading a class file causes an error.
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-