org.kuali.common.util
Class VersionUtils

java.lang.Object
  extended by org.kuali.common.util.VersionUtils

public class VersionUtils
extends Object


Field Summary
static String MAVEN_SNAPSHOT_TOKEN
           
 
Constructor Summary
VersionUtils()
           
 
Method Summary
protected static String getQualifier(String trimmed, String[] tokens)
           
static Version getVersion(String version)
          Parse a Version object from the version string.
static boolean isSnapshot(String version)
          Return true if version ends with -SNAPSHOT or .SNAPSHOT (case insensitive).
static String trimSnapshot(String version)
          Return version with .SNAPSHOT or -SNAPSHOT removed from the end (if present)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAVEN_SNAPSHOT_TOKEN

public static final String MAVEN_SNAPSHOT_TOKEN
See Also:
Constant Field Values
Constructor Detail

VersionUtils

public VersionUtils()
Method Detail

isSnapshot

public static final boolean isSnapshot(String version)
Return true if version ends with -SNAPSHOT or .SNAPSHOT (case insensitive).


trimSnapshot

public static final String trimSnapshot(String version)
Return version with .SNAPSHOT or -SNAPSHOT removed from the end (if present)
 1.0.0-SNAPSHOT returns 1.0.0
 1.0.0.SNAPSHOT returns 1.0.0
 1.0.0          returns 1.0.0
 1.0.0SNAPSHOT  returns 1.0.0SNAPSHOT
 


getVersion

public static final Version getVersion(String version)
Parse a Version object from the version string. The logic here is crudely simple. First SNAPSHOT is trimmed off the end of the string (if it exists). Whatever remains is then split into tokens using . and - as delimiters. The first 3 tokens encountered are major, minor, and incremental, respectively. Anything after that is the qualifier


getQualifier

protected static final String getQualifier(String trimmed,
                                           String[] tokens)


Copyright © 2010-2012 The Kuali Foundation. All Rights Reserved.