info.magnolia.module.model
Class Version

java.lang.Object
  extended by info.magnolia.module.model.Version

public class Version
extends Object

Represents a module version. Format is x.y.z-classifier. y,z and classifier are optional. The classifier string is ignored in version comparisons.

Version:
$Revision: $ ($Author: $)
Author:
gjoseph

Field Summary
static Version UNDEFINED_DEVELOPMENT_VERSION
           
static Version UNDEFINED_FROM
           
static Version UNDEFINED_TO
           
 
Constructor Summary
protected Version(int major, int minor, int patch)
          Convenience constructor that could be used to register Deltas or update tasks.
 
Method Summary
 boolean equals(Object o)
           
 String getClassifier()
           
 short getMajor()
           
 short getMinor()
           
 short getPatch()
           
 int hashCode()
           
 boolean isBeforeOrEquivalent(Version other)
           
 boolean isEquivalent(Version other)
          Compares major, minor and patch revisions of this Version against the given Version.
 boolean isStrictlyAfter(Version other)
           
static Version parseVersion(int major, int minor, int patch)
           
static Version parseVersion(String versionStr)
          Factory method that will parse a version string and return the correct Version implementation.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

UNDEFINED_FROM

public static final Version UNDEFINED_FROM

UNDEFINED_TO

public static final Version UNDEFINED_TO

UNDEFINED_DEVELOPMENT_VERSION

public static final Version UNDEFINED_DEVELOPMENT_VERSION
Constructor Detail

Version

protected Version(int major,
                  int minor,
                  int patch)
Convenience constructor that could be used to register Deltas or update tasks.

Method Detail

parseVersion

public static Version parseVersion(String versionStr)
Factory method that will parse a version string and return the correct Version implementation.

Parameters:
versionStr - version as string, for example 1.2.3-test. The String ${project.version} is interpreted as an undefined version during development ant it will always match version ranges
Returns:
a Version implementation, never null

parseVersion

public static Version parseVersion(int major,
                                   int minor,
                                   int patch)

isEquivalent

public boolean isEquivalent(Version other)
Compares major, minor and patch revisions of this Version against the given Version. Classifier is ignored.


isStrictlyAfter

public boolean isStrictlyAfter(Version other)

isBeforeOrEquivalent

public boolean isBeforeOrEquivalent(Version other)

getMajor

public short getMajor()

getMinor

public short getMinor()

getPatch

public short getPatch()

getClassifier

public String getClassifier()

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2003–2014 Magnolia International Ltd.. All rights reserved.