@HashCodeAndEqualsPlugin.Enhance public static class PackageDefinitionStrategy.ManifestReading.SealBaseLocator.ForTypeResourceUrl extends java.lang.Object implements PackageDefinitionStrategy.ManifestReading.SealBaseLocator
URLClassLoader
, i.e. tries
to deduct the base from a class's resource URL.PackageDefinitionStrategy.ManifestReading.SealBaseLocator.ForFixedValue, PackageDefinitionStrategy.ManifestReading.SealBaseLocator.ForTypeResourceUrl, PackageDefinitionStrategy.ManifestReading.SealBaseLocator.NonSealing
Modifier and Type | Field and 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 a
String 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 and Description |
---|
ForTypeResourceUrl()
Creates a new seal base locator that attempts deduction from a type's URL while using a
PackageDefinitionStrategy.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.
|
Modifier and Type | Method and Description |
---|---|
java.net.URL |
findSealBase(java.lang.ClassLoader classLoader,
java.lang.String typeName)
Locates the URL that should be used for sealing a package.
|
private static final int EXCLUDE_INITIAL_SLASH
String
manipulation that the initial slash should be excluded.private static final java.lang.String CLASS_FILE_EXTENSION
private static final java.lang.String JAR_FILE
private static final java.lang.String FILE_SYSTEM
private static final java.lang.String RUNTIME_IMAGE
private final PackageDefinitionStrategy.ManifestReading.SealBaseLocator fallback
public ForTypeResourceUrl()
PackageDefinitionStrategy.ManifestReading.SealBaseLocator.NonSealing
seal base locator
as a fallback.public ForTypeResourceUrl(PackageDefinitionStrategy.ManifestReading.SealBaseLocator fallback)
fallback
- The seal base locator to fallback to when a resource is not found or an unexpected URL protocol is discovered.public java.net.URL findSealBase(java.lang.ClassLoader classLoader, java.lang.String typeName)
findSealBase
in interface PackageDefinitionStrategy.ManifestReading.SealBaseLocator
classLoader
- The class loader loading the package.typeName
- The name of the type being loaded that triggered the package definition.null
if the package should not be sealed.