org.netbeans.modules.j2eeserver/4 1.89.0 1

org.netbeans.modules.j2ee.deployment.common.api
Class Version

java.lang.Object
  extended by org.netbeans.modules.j2ee.deployment.common.api.Version

public final class Version
extends Object

Represents the generic version. Useful for libraries, products etc.

This class is Immutable.

Since:
1.68

Method Summary
 boolean equals(Object obj)
          
static Version fromDottedNotationWithFallback(String version)
          Creates the version from the spec version string.
static Version fromJsr277NotationWithFallback(String version)
          Creates the version from the spec version string.
static Version fromJsr277OrDottedNotationWithFallback(String version)
          Creates the version from the spec version string.
 Integer getMajor()
          Returns the major number.
 Integer getMicro()
          Returns the micro number.
 Integer getMinor()
          Returns the minor number.
 String getQualifier()
          Returns the qualifier.
 Integer getUpdate()
          Returns the update.
 int hashCode()
          
 boolean isAboveOrEqual(Version other)
           
 boolean isBelowOrEqual(Version other)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

fromJsr277OrDottedNotationWithFallback

@NonNull
public static Version fromJsr277OrDottedNotationWithFallback(@NonNull
                                                                     String version)
Creates the version from the spec version string. Expected format is MAJOR_NUMBER[.MINOR_NUMBER[.MICRO_NUMBER[.UPDATE_NUMBER]]][-QUALIFIER] or MAJOR_NUMBER[.MINOR_NUMBER[.MICRO_NUMBER[.UPDATE_NUMBER[.QUALIFIER]]]] or GENERIC_VERSION_STRING. The string is evaluated in this order.

Parameters:
version - spec version string

fromJsr277NotationWithFallback

@NonNull
public static Version fromJsr277NotationWithFallback(@NonNull
                                                             String version)
Creates the version from the spec version string. Expected format is MAJOR_NUMBER[.MINOR_NUMBER[.MICRO_NUMBER[.UPDATE_NUMBER]]][-QUALIFIER] or GENERIC_VERSION_STRING.

Parameters:
version - spec version string with the following format: MAJOR_NUMBER[.MINOR_NUMBER[.MICRO_NUMBER[.UPDATE_NUMBER]]][-QUALIFIER] or GENERIC_VERSION_STRING

fromDottedNotationWithFallback

@NonNull
public static Version fromDottedNotationWithFallback(@NonNull
                                                             String version)
Creates the version from the spec version string. Expected format is MAJOR_NUMBER[.MINOR_NUMBER[.MICRO_NUMBER[.UPDATE_NUMBER[.QUALIFIER]]]] or GENERIC_VERSION_STRING.

Parameters:
version - spec version string with the following format: MAJOR_NUMBER[.MINOR_NUMBER[.MICRO_NUMBER[.UPDATE_NUMBER[.QUALIFIER]]]] or GENERIC_VERSION_STRING

getMajor

@CheckForNull
public Integer getMajor()
Returns the major number. May return null.

Returns:
the major number; may return null

getMinor

@CheckForNull
public Integer getMinor()
Returns the minor number. May return null.

Returns:
the minor number; may return null

getMicro

@CheckForNull
public Integer getMicro()
Returns the micro number. May return null.

Returns:
the micro number; may return null

getUpdate

@CheckForNull
public Integer getUpdate()
Returns the update. May return null.

Returns:
the update; may return null

getQualifier

@CheckForNull
public String getQualifier()
Returns the qualifier. May return null.

Returns:
the qualifier; may return null

equals

public boolean equals(Object obj)

Two versions are equal if and only if they have same major, minor, micro, update number and qualifier. If the version does not conform to notation the versions are equal only if the version strings exactly matches.

Overrides:
equals in class Object

hashCode

public int hashCode()

The implementation consistent with equals(Object).

Overrides:
hashCode in class Object

isAboveOrEqual

public boolean isAboveOrEqual(Version other)

isBelowOrEqual

public boolean isBelowOrEqual(Version other)

toString

public String toString()
Overrides:
toString in class Object

org.netbeans.modules.j2eeserver/4 1.89.0 1

Built on May 22 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.