Package org.kiwiproject.beta.base.jar
Class JarManifests
java.lang.Object
org.kiwiproject.beta.base.jar.JarManifests
Static utilities related to JAR manifests.
If you need to be able to mock the functionality in this class
for testing, consider using JarManifestHelper instead.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongetMainAttributesAsMap(Manifest manifest) Return the main attributes of the Manifest, using the given Class to locate the associatedMANIFEST.MFfile.getMainAttributesAsMapOrThrow(Class<?> theClass) Return the main attributes of the Manifest, using the given Class to locate the associatedMANIFEST.MFfile.getMainAttributeValue(Class<?> theClass, String name) Get the main attribute value in a Manifest, using the given Class to locate the associatedMANIFEST.MFfile.getMainAttributeValue(Manifest manifest, String name) Get the main attribute value in a Manifest having the given name.static StringgetMainAttributeValueOrThrow(Class<?> theClass, String name) Get the main attribute value in a Manifest, using the given Class to locate the associatedMANIFEST.MFfile.getManifest(Class<?> theClass) Use the given Class to locate the associatedMANIFEST.MFfile.getManifest(URI jarFileURI) Use the given URI to locate the associatedMANIFEST.MFfile.static ManifestgetManifestOrThrow(Class<?> theClass) Use the given Class to locate the associatedMANIFEST.MFfile.
-
Method Details
-
getMainAttributeValueOrThrow
Get the main attribute value in a Manifest, using the given Class to locate the associatedMANIFEST.MFfile.- Parameters:
theClass- the Class to use for finding the Manifestname- the name of the main attribute- Returns:
- the value of the attribute
- Throws:
IllegalStateException- if the lookup failed or the attribute does not exist
-
getMainAttributeValue
Get the main attribute value in a Manifest, using the given Class to locate the associatedMANIFEST.MFfile.- Parameters:
theClass- the Class to use for finding the Manifestname- the name of the main attribute- Returns:
- an Optional containing the value, or an empty Optional if the looked failed
-
getMainAttributeValue
Get the main attribute value in a Manifest having the given name.- Parameters:
manifest- the Manifestname- the name of the main attribute- Returns:
- an Optional containing the value, or an empty Optional if the lookup failed
-
getMainAttributesAsMapOrThrow
Return the main attributes of the Manifest, using the given Class to locate the associatedMANIFEST.MFfile.- Parameters:
theClass- the Class to use for finding the Manifest- Returns:
- a map containing the main attributes
- Throws:
IllegalStateException- if the lookup fails for any reason
-
getMainAttributesAsMap
Return the main attributes of the Manifest, using the given Class to locate the associatedMANIFEST.MFfile.- Parameters:
manifest- the manifest- Returns:
- a map containing the main attributes
-
getManifestOrThrow
Use the given Class to locate the associatedMANIFEST.MFfile.- Parameters:
theClass- the Class to use for finding the Manifest- Returns:
- the Manifest
- Throws:
IllegalStateException- if the lookup fails for any reason
-
getManifest
Use the given Class to locate the associatedMANIFEST.MFfile.- Parameters:
theClass- the Class to use for finding the Manifest- Returns:
- an Optional containing the Manifest, or an empty Optional if the lookup failed
-
getManifest
Use the given URI to locate the associatedMANIFEST.MFfile.- Parameters:
jarFileURI- the URI of the JAR file in which the manifest resides- Returns:
- an Optional containing the Manifest, or an empty Optional if any error occurs
-