org.codehaus.mojo.versions.api
Class UpdateScope

java.lang.Object
  extended by org.codehaus.mojo.versions.api.UpdateScope
All Implemented Interfaces:
Serializable, Comparable

public abstract class UpdateScope
extends Object
implements Comparable, Serializable

Scopes of version updates.

Since:
1.0-beta-1
Author:
Stephen Connolly
See Also:
Serialized Form

Field Summary
static UpdateScope ANY
          Any version updates.
static UpdateScope INCREMENTAL
          Incremental version updates, that is the third segment of the version number, for example 1.0.0.15 to 1.0.1.0.
static UpdateScope MAJOR
          Major version updates, that is the first segment of the version number, for example 1.0.0.15 to 2.0.0.0.
static UpdateScope MINOR
          Minor version updates, that is the second segment of the version number, for example 1.0.0.15 to 1.1.0.0.
static UpdateScope SUBINCREMENTAL
          Versions which are less than an incremental update.
 
Method Summary
static UpdateScope classifyUpdate(VersionComparator comparator, org.apache.maven.artifact.versioning.ArtifactVersion from, org.apache.maven.artifact.versioning.ArtifactVersion to)
          Classifies the type of update.
protected  Object clone()
          Throws CloneNotSupportedException.
 int compareTo(Object o)
          Compares this enum with the specified object for order.
 boolean equals(Object o)
          
protected  void finalize()
          enum classes cannot have finalize methods.
abstract  org.apache.maven.artifact.versioning.ArtifactVersion[] getAllUpdates(VersionDetails versionDetails, org.apache.maven.artifact.versioning.ArtifactVersion currentVersion, boolean includeSnapshots)
          Returns all versions newer than the specified current version within this scope.
 Class getDeclaringClass()
          Returns the Class object corresponding to this enum constant's enum type.
abstract  org.apache.maven.artifact.versioning.ArtifactVersion getNewestUpdate(VersionDetails versionDetails, org.apache.maven.artifact.versioning.ArtifactVersion currentVersion, boolean includeSnapshots)
          Returns the newest version after the specified current version within this scope.
abstract  org.apache.maven.artifact.versioning.ArtifactVersion getOldestUpdate(VersionDetails versionDetails, org.apache.maven.artifact.versioning.ArtifactVersion currentVersion, boolean includeSnapshots)
          Returns the next version after the specified current version within this scope.
 int hashCode()
          
 String name()
          Returns the name of this enum constant, exactly as declared in its enum declaration.
 int ordinal()
          Returns the ordinal of this enumeration constant (its position in its enum declaration, where the initial constant is assigned an ordinal of zero).
 String toString()
          
static UpdateScope valueOf(String name)
          Returns the enum constant of the specified enum type with the specified name.
static UpdateScope[] values()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SUBINCREMENTAL

public static final UpdateScope SUBINCREMENTAL
Versions which are less than an incremental update.

Since:
1.0-beta-1

INCREMENTAL

public static final UpdateScope INCREMENTAL
Incremental version updates, that is the third segment of the version number, for example 1.0.0.15 to 1.0.1.0.

Since:
1.0-beta-1

MINOR

public static final UpdateScope MINOR
Minor version updates, that is the second segment of the version number, for example 1.0.0.15 to 1.1.0.0.

Since:
1.0-beta-1

MAJOR

public static final UpdateScope MAJOR
Major version updates, that is the first segment of the version number, for example 1.0.0.15 to 2.0.0.0.

Since:
1.0-beta-1

ANY

public static final UpdateScope ANY
Any version updates.

Since:
1.0-beta-1
Method Detail

getOldestUpdate

public abstract org.apache.maven.artifact.versioning.ArtifactVersion getOldestUpdate(VersionDetails versionDetails,
                                                                                     org.apache.maven.artifact.versioning.ArtifactVersion currentVersion,
                                                                                     boolean includeSnapshots)
Returns the next version after the specified current version within this scope.

Parameters:
versionDetails - The versions to select from.
currentVersion - The current version.
includeSnapshots - Whether to include snapshots.
Returns:
The next version within this scope or null if there is no version within this scope.
Throws:
org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException - if there was a problem retrieving the list of available versions.

getNewestUpdate

public abstract org.apache.maven.artifact.versioning.ArtifactVersion getNewestUpdate(VersionDetails versionDetails,
                                                                                     org.apache.maven.artifact.versioning.ArtifactVersion currentVersion,
                                                                                     boolean includeSnapshots)
Returns the newest version after the specified current version within this scope.

Parameters:
versionDetails - The versions to select from.
currentVersion - The current version.
includeSnapshots - Whether to include snapshots.
Returns:
The newest version within this scope or null if there is no version within this scope.

getAllUpdates

public abstract org.apache.maven.artifact.versioning.ArtifactVersion[] getAllUpdates(VersionDetails versionDetails,
                                                                                     org.apache.maven.artifact.versioning.ArtifactVersion currentVersion,
                                                                                     boolean includeSnapshots)
Returns all versions newer than the specified current version within this scope.

Parameters:
versionDetails - The versions to select from.
currentVersion - The current version.
includeSnapshots - Whether to include snapshots.
Returns:
All newer versions within this scope.

name

public final String name()
Returns the name of this enum constant, exactly as declared in its enum declaration.

Most programmers should use the toString() method in preference to this one, as the toString method may return a more user-friendly name. This method is designed primarily for use in specialized situations where correctness depends on getting the exact name, which will not vary from release to release.

Returns:
the name of this enum constant

ordinal

public final int ordinal()
Returns the ordinal of this enumeration constant (its position in its enum declaration, where the initial constant is assigned an ordinal of zero).

Most programmers will have no use for this method.

Returns:
the ordinal of this enumeration constant

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

clone

protected final Object clone()
                      throws CloneNotSupportedException
Throws CloneNotSupportedException. This guarantees that levels are never cloned, which is necessary to preserve their "singleton" status.

Overrides:
clone in class Object
Returns:
(neverreturns)
Throws:
CloneNotSupportedException

compareTo

public final int compareTo(Object o)
Compares this enum with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Enum constants are only comparable to other enum constants of the same enum type. The natural order implemented by this method is the order in which the constants are declared.

Specified by:
compareTo in interface Comparable

getDeclaringClass

public final Class getDeclaringClass()
Returns the Class object corresponding to this enum constant's enum type. Two enum constants e1 and e2 are of the same enum type if and only if e1.getDeclaringClass() == e2.getDeclaringClass(). (The value returned by this method may differ from the one returned by the Object.getClass() method for enum constants with constant-specific class bodies.)

Returns:
the Class object corresponding to this enum constant's enum type

valueOf

public static UpdateScope valueOf(String name)
Returns the enum constant of the specified enum type with the specified name. The name must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the constant to return
Returns:
the enum constant of the specified enum type with the specified name
Throws:
IllegalArgumentException - if the specified enum type has no constant with the specified name, or the specified class object does not represent an enum type
NullPointerException - if enumType or name is null

values

public static UpdateScope[] values()

classifyUpdate

public static UpdateScope classifyUpdate(VersionComparator comparator,
                                         org.apache.maven.artifact.versioning.ArtifactVersion from,
                                         org.apache.maven.artifact.versioning.ArtifactVersion to)
Classifies the type of update.

Parameters:
comparator - The version comparator to use for classifying.
from - The first version.
to - The second version.
Returns:
The update classification.

finalize

protected final void finalize()
                       throws Throwable
enum classes cannot have finalize methods.

Overrides:
finalize in class Object
Throws:
Throwable


Copyright © 2008-2011 Codehaus. All Rights Reserved.