public final class JkManifest<T>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
T |
__
For parent chaining
|
static java.lang.String |
BUILD_JDK
The JDK version who was running while building this manifest.
|
static java.lang.String |
CREATED_BY
The software that has created this manifest.
|
static java.lang.String |
IMPLEMENTATION_TITLE
The title of the implementation.
|
static java.lang.String |
IMPLEMENTATION_VENDOR
The version of the implementation.
|
static java.lang.String |
IMPLEMENTATION_VERSION
The version of the implementation.
|
static java.lang.String |
STANDARD_LOCATION
The path where generally belongs all manifest past (relative to archive root)
|
Modifier and Type | Method and Description |
---|---|
JkManifest<T> |
addAutodetectMain(java.nio.file.Path classDir)
Adds the main class entry by auto-detecting the class holding the main method.
|
JkManifest<T> |
addContextualInfo()
|
JkManifest<T> |
addMainAttribute(java.util.jar.Attributes.Name key,
java.lang.String value)
Adds the specified attributes in the "main" attributes section.
|
JkManifest<T> |
addMainAttribute(java.lang.String key,
java.lang.String value) |
JkManifest<T> |
addMainClass(java.lang.String value)
Adds the 'Main-Class' attribute to this manifest.
|
java.lang.String |
getMainAttribute(java.util.jar.Attributes.Name name)
Returns the value of the main attribute having the specified name.
|
java.lang.String |
getMainAttribute(java.lang.String key)
Returns the value of the main attribute having the specified name.
|
java.util.jar.Manifest |
getManifest()
Returns the underlying JDK
Manifest object. |
boolean |
isEmpty()
Returns
true if this manifest has no entry or has only
"Manifest-Version" entry. |
JkManifest<T> |
loadFromClass(java.lang.Class<?> clazz)
Loads the manifest from the jar or the base class directory the specified class belongs to.
|
JkManifest<T> |
loadFromFile(java.nio.file.Path file)
Loads the manifest file from the specified path and set it as the underlying manifest.
|
JkManifest<T> |
loadFromInputStream(java.io.InputStream inputStream)
Loads the manifest from the specified input stream and set it as the underlying manifest.
|
JkManifest<T> |
loadFromJar(java.nio.file.Path jar) |
JkManifest<T> |
merge(java.util.jar.Manifest other)
Adds attributes of the specified manifest to this one.
|
static JkManifest<java.lang.Void> |
of()
Creates an empty JkManifest
|
static <T> JkManifest<T> |
ofParent(T parent)
Same as
of() but providing a parent for method chaining |
JkManifest<T> |
set(java.util.jar.Manifest manifest)
Set the underlying
Manifest with the specified one. |
void |
writeTo(java.nio.file.Path file) |
void |
writeToStandardLocation(java.nio.file.Path classDir)
Writes this manifest at the standard place (META-INF/MANIFEST.MF) of the
specified directory.
|
public static final java.lang.String STANDARD_LOCATION
public static final java.lang.String BUILD_JDK
public static final java.lang.String CREATED_BY
public static final java.lang.String IMPLEMENTATION_TITLE
public static final java.lang.String IMPLEMENTATION_VERSION
public static final java.lang.String IMPLEMENTATION_VENDOR
public final T __
public static JkManifest<java.lang.Void> of()
public static <T> JkManifest<T> ofParent(T parent)
of()
but providing a parent for method chainingpublic java.util.jar.Manifest getManifest()
Manifest
object.public JkManifest<T> set(java.util.jar.Manifest manifest)
Manifest
with the specified one.public JkManifest<T> loadFromFile(java.nio.file.Path file)
public JkManifest<T> loadFromJar(java.nio.file.Path jar)
public JkManifest<T> loadFromInputStream(java.io.InputStream inputStream)
public JkManifest<T> loadFromClass(java.lang.Class<?> clazz)
public JkManifest<T> addMainAttribute(java.util.jar.Attributes.Name key, java.lang.String value)
public JkManifest<T> addAutodetectMain(java.nio.file.Path classDir)
public JkManifest<T> addMainAttribute(java.lang.String key, java.lang.String value)
#addMainAttribute(Name, String)
public JkManifest<T> addMainClass(java.lang.String value)
public JkManifest<T> addContextualInfo()
public java.lang.String getMainAttribute(java.lang.String key)
public java.lang.String getMainAttribute(java.util.jar.Attributes.Name name)
public JkManifest<T> merge(java.util.jar.Manifest other)
public void writeToStandardLocation(java.nio.file.Path classDir)
public void writeTo(java.nio.file.Path file)
public boolean isEmpty()
true
if this manifest has no entry or has only
"Manifest-Version" entry.