Class ManifestUtils


  • public class ManifestUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      ManifestUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getVersionFromManifest​(java.lang.Class<?> clazz, java.lang.String jarName, java.lang.String defaultVersion)
      Attempt to figure out the version of a given library/jar from its MANIFEST.MF file.
      static java.lang.String getVersionFromManifest​(java.util.jar.Manifest manifest)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ManifestUtils

        public ManifestUtils()
    • Method Detail

      • getVersionFromManifest

        public static java.lang.String getVersionFromManifest​(java.lang.Class<?> clazz,
                                                              java.lang.String jarName,
                                                              java.lang.String defaultVersion)
        Attempt to figure out the version of a given library/jar from its MANIFEST.MF file. If nothing can be found, use the default value provided as a fallback. This first attempts to get the manifest file via a "fast path" using the jar of the provided class file. If that fails, we scan all manifests for the correct one based on the expected jar name.
        Parameters:
        clazz - a class to get the jar for
        jarName - the name of the jar file to do a "contains" match on
        defaultVersion - a default value to return if nothing is found in the manifest
        Returns:
        the version of the library based on the MANIFEST.MF file
      • getVersionFromManifest

        public static java.lang.String getVersionFromManifest​(java.util.jar.Manifest manifest)