Package net.bytebuddy.dynamic.loading
Class PackageDefinitionStrategy.ManifestReading.SealBaseLocator.ForTypeResourceUrl
- java.lang.Object
-
- net.bytebuddy.dynamic.loading.PackageDefinitionStrategy.ManifestReading.SealBaseLocator.ForTypeResourceUrl
-
- All Implemented Interfaces:
PackageDefinitionStrategy.ManifestReading.SealBaseLocator
- Enclosing interface:
- PackageDefinitionStrategy.ManifestReading.SealBaseLocator
@Enhance public static class PackageDefinitionStrategy.ManifestReading.SealBaseLocator.ForTypeResourceUrl extends java.lang.Object implements PackageDefinitionStrategy.ManifestReading.SealBaseLocator
A seal base locator that imitates the behavior of aURLClassLoader
, i.e. tries to deduct the base from a class's resource URL.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.dynamic.loading.PackageDefinitionStrategy.ManifestReading.SealBaseLocator
PackageDefinitionStrategy.ManifestReading.SealBaseLocator.ForFixedValue, PackageDefinitionStrategy.ManifestReading.SealBaseLocator.ForTypeResourceUrl, PackageDefinitionStrategy.ManifestReading.SealBaseLocator.NonSealing
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
CLASS_FILE_EXTENSION
The file extension for a class file.private static int
EXCLUDE_INITIAL_SLASH
An index to indicate to aString
manipulation that the initial slash should be excluded.private PackageDefinitionStrategy.ManifestReading.SealBaseLocator
fallback
The seal base locator to fallback to when a resource is not found or an unexpected URL protocol is discovered.private static java.lang.String
FILE_SYSTEM
The protocol name of a file system link.private static java.lang.String
JAR_FILE
The protocol name of a jar file.private static java.lang.String
RUNTIME_IMAGE
The protocol name of a Java 9 runtime image.
-
Constructor Summary
Constructors Constructor Description ForTypeResourceUrl()
Creates a new seal base locator that attempts deduction from a type's URL while using aPackageDefinitionStrategy.ManifestReading.SealBaseLocator.NonSealing
seal base locator as a fallback.ForTypeResourceUrl(PackageDefinitionStrategy.ManifestReading.SealBaseLocator fallback)
Creates a new seal base locator that attempts deduction from a type's URL.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.net.URL
findSealBase(java.lang.ClassLoader classLoader, java.lang.String typeName)
Locates the URL that should be used for sealing a package.
-
-
-
Field Detail
-
EXCLUDE_INITIAL_SLASH
private static final int EXCLUDE_INITIAL_SLASH
An index to indicate to aString
manipulation that the initial slash should be excluded.- See Also:
- Constant Field Values
-
CLASS_FILE_EXTENSION
private static final java.lang.String CLASS_FILE_EXTENSION
The file extension for a class file.- See Also:
- Constant Field Values
-
JAR_FILE
private static final java.lang.String JAR_FILE
The protocol name of a jar file.- See Also:
- Constant Field Values
-
FILE_SYSTEM
private static final java.lang.String FILE_SYSTEM
The protocol name of a file system link.- See Also:
- Constant Field Values
-
RUNTIME_IMAGE
private static final java.lang.String RUNTIME_IMAGE
The protocol name of a Java 9 runtime image.- See Also:
- Constant Field Values
-
fallback
private final PackageDefinitionStrategy.ManifestReading.SealBaseLocator fallback
The seal base locator to fallback to when a resource is not found or an unexpected URL protocol is discovered.
-
-
Constructor Detail
-
ForTypeResourceUrl
public ForTypeResourceUrl()
Creates a new seal base locator that attempts deduction from a type's URL while using aPackageDefinitionStrategy.ManifestReading.SealBaseLocator.NonSealing
seal base locator as a fallback.
-
ForTypeResourceUrl
public ForTypeResourceUrl(PackageDefinitionStrategy.ManifestReading.SealBaseLocator fallback)
Creates a new seal base locator that attempts deduction from a type's URL.- Parameters:
fallback
- The seal base locator to fallback to when a resource is not found or an unexpected URL protocol is discovered.
-
-
Method Detail
-
findSealBase
public java.net.URL findSealBase(java.lang.ClassLoader classLoader, java.lang.String typeName)
Locates the URL that should be used for sealing a package.- Specified by:
findSealBase
in interfacePackageDefinitionStrategy.ManifestReading.SealBaseLocator
- Parameters:
classLoader
- The class loader loading the package.typeName
- The name of the type being loaded that triggered the package definition.- Returns:
- The URL that is used for sealing a package or
null
if the package should not be sealed.
-
-