|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.mmm.util.reflect.base.ManifestLoader
public class ManifestLoader
This class loads all Manifests from your classpath. After
construction an instance of this class allows you to get the list of Manifests. This allows you to determine details
(e.g. the name and version) about the libraries in your classpath.
| Field Summary | |
|---|---|
private static String |
JAR_SUFFIX
The JAR suffix. |
static Attributes.Name |
MANIFEST_SOURCE
The Name of the source of the Manifest. |
private List<Manifest> |
manifests
the list of the manifests |
| Constructor Summary | |
|---|---|
|
ManifestLoader()
The constructor. |
private |
ManifestLoader(ClassLoader classloader)
The constructor. |
| Method Summary | |
|---|---|
private static void |
completeManifest(Manifest manifest,
URL url)
This method adds dynamic attributes to the given manifest. |
List<Manifest> |
getManifests()
This method gets an unmodifiable list with all available Manifests. |
static String |
getValue(Manifest manifest,
Attributes.Name name)
This method gets an attribute-value from a Manifest in a pragmatic
way. |
static Manifest |
loadManifest(Class<?> type)
This method tries to load the Manifest for the given Class. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Attributes.Name MANIFEST_SOURCE
Name of the source of the Manifest.
This is a property that is NOT intended to be defined in the manifest file
itself but is set dynamically as main-property to the source of the manifest (e.g. the name of the
JAR-file) if loaded via ManifestLoader.
private static final String JAR_SUFFIX
private final List<Manifest> manifests
| Constructor Detail |
|---|
public ManifestLoader()
throws RuntimeIoException
RuntimeIoException - if a general I/O error occurred while
reflectively reading the manifests.
private ManifestLoader(ClassLoader classloader)
throws RuntimeIoException
classloader - is the ClassLoader used to find and load the
Manifests.
RuntimeIoException - if a general I/O error occurred while
reflectively reading the manifests.| Method Detail |
|---|
private static void completeManifest(Manifest manifest,
URL url)
manifest.
manifest - is the Manifest to modify.url - is the URL with the source of the manifest.public List<Manifest> getManifests()
Manifests.
On a Manifest you may call something like this:
manifest.getMainAttributes().getValue(Attributes.Name.IMPLEMENTATION_VERSION)
Manifest.getMainAttributes(),
Attributes.Name,
MANIFEST_SOURCEpublic static Manifest loadManifest(Class<?> type)
Manifest for the given Class.
E.g. if the given Class comes from a JarFile the
Manifest of that JarFile is returned.
type - is the Class for which the according Manifest
is requested.
Manifest or null if NOT
available.
public static String getValue(Manifest manifest,
Attributes.Name name)
Manifest in a pragmatic
way. It tries to get the value from the main-attributes. If NOT available it searches all other
available attribute entries for the value and
returns the first one found in deterministic but unspecified order.
manifest - is the Manifest where to get the attribute-value
from.name - is the Name of the requested attribute.
null if NOT available.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||