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 Object
implements PackageDefinitionStrategy.ManifestReading.SealBaseLocator
A seal base locator that imitates the behavior of a
URLClassLoader
, 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
FieldsModifier and TypeFieldDescriptionprivate static final String
The file extension for a class file.private static final int
An index to indicate to aString
manipulation that the initial slash should be excluded.The seal base locator to fallback to when a resource is not found or an unexpected URL protocol is discovered.private static final String
The protocol name of a file system link.private static final String
The protocol name of a jar file.private static final String
The protocol name of a Java 9 runtime image. -
Constructor Summary
ConstructorsConstructorDescriptionCreates 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.Creates a new seal base locator that attempts deduction from a type's URL. -
Method Summary
Modifier and TypeMethodDescriptionfindSealBase
(ClassLoader classLoader, String typeName) Locates the URL that should be used for sealing a package.
-
Field Details
-
EXCLUDE_INITIAL_SLASH
private static final int EXCLUDE_INITIAL_SLASHAn index to indicate to aString
manipulation that the initial slash should be excluded.- See Also:
-
CLASS_FILE_EXTENSION
The file extension for a class file.- See Also:
-
JAR_FILE
The protocol name of a jar file.- See Also:
-
FILE_SYSTEM
The protocol name of a file system link.- See Also:
-
RUNTIME_IMAGE
The protocol name of a Java 9 runtime image.- See Also:
-
fallback
The seal base locator to fallback to when a resource is not found or an unexpected URL protocol is discovered.
-
-
Constructor Details
-
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
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 Details
-
findSealBase
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.
-