org.scijava.util
Class VersionUtils

java.lang.Object
  extended by org.scijava.util.VersionUtils

public class VersionUtils
extends Object

Useful methods for retrieving versions from JARs and POMs associated with Class objects.

Author:
Curtis Rueden, Mark Hiner

Constructor Summary
VersionUtils()
           
 
Method Summary
static String getVersion(Class<?> c)
          Looks up the version of the specified class using any means available.
static String getVersion(Class<?> c, String groupId, String artifactId)
          Looks up the version of the specified class using any means available.
static String getVersionFromManifest(Class<?> c)
          Looks up the version of the specified class using a JAR manifest if available.
static String getVersionFromPOM(Class<?> c, String groupId, String artifactId)
          Looks up the version of the specified class using the specified POM, or base POM directory if groupId and artifactId are null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VersionUtils

public VersionUtils()
Method Detail

getVersion

public static String getVersion(Class<?> c)
Looks up the version of the specified class using any means available. Will only search POMs in the base directory.

Parameters:
c - - Look up this Class's version
Returns:
Version of specified Class or null if not found.

getVersion

public static String getVersion(Class<?> c,
                                String groupId,
                                String artifactId)
Looks up the version of the specified class using any means available. groupId and artifactId allow specification of the POM lookup path.

Parameters:
c - - Look up this Class's version
groupId - - GroupID containing class
artifactId - - ArtifactID containing class
Returns:
Version of specified Class or null if not found.

getVersionFromManifest

public static String getVersionFromManifest(Class<?> c)
Looks up the version of the specified class using a JAR manifest if available.

Parameters:
c - - Look up this Class's version
Returns:
Version of specified Class or null if not found.

getVersionFromPOM

public static String getVersionFromPOM(Class<?> c,
                                       String groupId,
                                       String artifactId)
Looks up the version of the specified class using the specified POM, or base POM directory if groupId and artifactId are null.

Parameters:
c - - Look up this Class's version
groupId - - GroupID containing class
artifactId - - ArtifactID containing class
Returns:
Version of specified Class or null if not found.


Copyright © 2009–2014 SciJava. All rights reserved.