APIdia Launch Partner
Top Description Constructors Methods
io.github.spannm.jackcess.about

public final Class ThisLib

extends Object
Class Inheritance
Imports
java.io.IOException, .InputStream, java.net.URL, java.security.CodeSource, java.util.AbstractMap.SimpleImmutableEntry, .Arrays, .List, .Map, .Optional, java.util.jar.Attributes, .Manifest

Provides metadata and build information about this library when executed directly via CLI.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static String

Returns:

the formatted metadata text, terminated with a trailing line separator
buildInfo
(Manifest
the manifest to read metadata from, may be null
manifest
)

Builds the formatted metadata text printed when the JAR file is executed directly.

private static Map.Entry<String, String>

Returns:

immutable map entry
entry
(String
metadata key
key
,
String
metadata value
value
)

Creates an immutable map entry representing a key-value metadata pair.

private static Optional<String>

Returns:

an Optional containing the trimmed value, or empty if null or blank
findInAttributes
(Attributes
the attributes container, may be null
attributes
,
String
the name of the attribute
name
)

Extract and trims an attribute value from the given attributes object.

private static Optional<String>

Returns:

an Optional containing the first non-blank attribute value, or empty
getAttribute
(Manifest
the manifest to search in, may be null
manifest
,
String...
one or more attribute names to look for
attributeNames
)

Searches for the given attribute names in the main attributes first.

public static void
main(String[]
command-line arguments (unused)
args
)

Main entry point when the JAR file is executed directly.

private static Optional<Manifest>

Returns:

an Optional containing the parsed Manifest, or empty if unavailable
readManifest
()

Resolves and parses the MANIFEST.MF file from the location of this class's code source.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ThisLibback to summary
private ThisLib()

Method Detail

buildInfoback to summary
pack-priv static String buildInfo(Manifest manifest)

Builds the formatted metadata text printed when the JAR file is executed directly.

Parameters
manifest:Manifest

the manifest to read metadata from, may be null

Returns:String

the formatted metadata text, terminated with a trailing line separator

entryback to summary
private static Map.Entry<String, String> entry(String key, String value)

Creates an immutable map entry representing a key-value metadata pair.

Parameters
key:String

metadata key

value:String

metadata value

Returns:Map.Entry<String, String>

immutable map entry

findInAttributesback to summary
private static Optional<String> findInAttributes(Attributes attributes, String name)

Extract and trims an attribute value from the given attributes object.

Parameters
attributes:Attributes

the attributes container, may be null

name:String

the name of the attribute

Returns:Optional<String>

an Optional containing the trimmed value, or empty if null or blank

getAttributeback to summary
private static Optional<String> getAttribute(Manifest manifest, String... attributeNames)

Searches for the given attribute names in the main attributes first.

If not found, searches across all named individual sections in the manifest.

Parameters
manifest:Manifest

the manifest to search in, may be null

attributeNames:String[]

one or more attribute names to look for

Returns:Optional<String>

an Optional containing the first non-blank attribute value, or empty

mainback to summary
public static void main(String[] args)

Main entry point when the JAR file is executed directly.

Reads the MANIFEST.MF file from the JAR package and prints formatted metadata to System.out.

Parameters
args:String[]

command-line arguments (unused)

readManifestback to summary
private static Optional<Manifest> readManifest()

Resolves and parses the MANIFEST.MF file from the location of this class's code source.

Returns:Optional<Manifest>

an Optional containing the parsed Manifest, or empty if unavailable