Top Constructors Methods
org.eclipse.jetty.util

public Class ManifestUtils

extends Object
Class Inheritance
Imports
java.io.File, java.net.URL, java.security.CodeSource, java.util.Optional, java.util.jar.JarFile, .Manifest

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Optional<Manifest>
getManifest(Class<?> klass)

public static Optional<String>

Returns:

the jar/module version, or an empty Optional
getVersion
(Class<?>
the class of the jar/module to retrieve the version
klass
)

Attempts to return the version of the jar/module for the given class.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ManifestUtilsback to summary
private ManifestUtils()

Method Detail

getManifestback to summary
public static Optional<Manifest> getManifest(Class<?> klass)
getVersionback to summary
public static Optional<String> getVersion(Class<?> klass)

Attempts to return the version of the jar/module for the given class.

First, retrieves the Implementation-Version main attribute of the manifest; if that is missing, retrieves the JPMS module version (via reflection); if that is missing, returns an empty Optional.

Parameters
klass:Class<?>

the class of the jar/module to retrieve the version

Returns:Optional<String>

the jar/module version, or an empty Optional