@HashCodeAndEqualsPlugin.Enhance public static class ClassFileLocator.Simple extends java.lang.Object implements ClassFileLocator
ClassFileLocator.AgentBased, ClassFileLocator.Compound, ClassFileLocator.ForClassLoader, ClassFileLocator.ForFolder, ClassFileLocator.ForJarFile, ClassFileLocator.ForModule, ClassFileLocator.ForModuleFile, ClassFileLocator.ForUrl, ClassFileLocator.NoOp, ClassFileLocator.PackageDiscriminating, ClassFileLocator.Resolution, ClassFileLocator.Simple
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,byte[]> |
classFiles
The class files that are known to this class file locator mapped by their type name.
|
CLASS_FILE_EXTENSION
Constructor and Description |
---|
Simple(java.util.Map<java.lang.String,byte[]> classFiles)
Creates a new simple class file locator.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
ClassFileLocator.Resolution |
locate(java.lang.String name)
Locates the class file for a given type and returns the binary data of the class file.
|
static ClassFileLocator |
of(DynamicType dynamicType)
Creates a class file locator that represents all types of a dynamic type.
|
static ClassFileLocator |
of(java.util.Map<TypeDescription,byte[]> binaryRepresentations)
Creates a class file locator that represents all types of a dynamic type.
|
static ClassFileLocator |
of(java.lang.String typeName,
byte[] binaryRepresentation)
Creates a class file locator for a single known type.
|
static ClassFileLocator |
ofResources(java.util.Map<java.lang.String,byte[]> binaryRepresentations)
Creates a class file locator of a map of resources where class files are mapped by their path and file extension.
|
private final java.util.Map<java.lang.String,byte[]> classFiles
public Simple(java.util.Map<java.lang.String,byte[]> classFiles)
classFiles
- The class files that are known to this class file locator mapped by their type name.public static ClassFileLocator of(java.lang.String typeName, byte[] binaryRepresentation)
typeName
- The name of the type.binaryRepresentation
- The binary representation of the type.public static ClassFileLocator of(DynamicType dynamicType)
dynamicType
- The dynamic type to represent.public static ClassFileLocator of(java.util.Map<TypeDescription,byte[]> binaryRepresentations)
binaryRepresentations
- The binary representation of all types.public static ClassFileLocator ofResources(java.util.Map<java.lang.String,byte[]> binaryRepresentations)
binaryRepresentations
- A map of resource names to their binary representation.public ClassFileLocator.Resolution locate(java.lang.String name)
locate
in interface ClassFileLocator
name
- The name of the type to locate a class file representation for.public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable