• BlackBerry Dynamics
  • Runtime library for Android applications
  • 9.2.0.99
GDVersion Class Reference

BlackBerry Dynamics entitlement version. More...

Inherits Comparable< GDVersion >.

Description

Objects of this class are used to represent BlackBerry Dynamics entitlement versions.

BlackBerry Dynamics entitlement versions are sequences of numbers. The first number is the major version number and is the most significant. Numbers later in the sequence are of decreasing significance. By convention, there are four numbers in an entitlement version.

In the BlackBerry Dynamics management console, and in other administrative user interfaces, entitlement versions are represented by "dotted string" values, in which the numbers are separated by full stops (periods).

Objects of this class are used in the GDAndroid.getEntitlementVersions results list.

Interface Usage

import com.good.gd.GDVersion
// Initialize from dotted string representation.
GDVersion gdVersionA = new GDVersion("1.2.0.3");
int length = gdVersionA.numberOfVersionParts();
// length == 4
int majorVersion = gdVersionA.versionPartAt(0);
// majorVersion == 1
// Initialize from array of numbers.
GDVersion gdVersionB = new GDVersion( Arrays.asList(1, 3) );
length = gdVersionB.numberOfVersionParts();
// length == 2
int comparison = gdVersionA.compareTo(gdVersionB);
// comparison == -1
comparison = gdVersionB.compareTo(gdVersionA);
// comparison == 1
GDVersion gdVersionC = new GDVersion("1.3");
comparison = gdVersionB.compareTo(gdVersionC);
// comparison == 0
Boolean isOrder = gdVersionA.isEqualToVersion(gdVersionB);
// isOrder == false
isOrder = gdVersionA.isGreaterThanVersion(gdVersionB);
// isOrder == false
isOrder = gdVersionA.isLessThanVersion(gdVersionB);
// isOrder == true
String dottedString = gdVersionB.toString();
// dottedString.isEqual("1.3") == true

The code snippet above illustrates the programming interface.

Public Member Functions

 GDVersion (String version)
 Construct from a dotted string representation. More...
 
 GDVersion (List< Integer > version)
 Construct from an array of Integer values. More...
 
int numberOfVersionParts ()
 Count of how many constituent numbers are in the version. More...
 
int versionPartAtPosition (int position)
 Get one constituent version number. More...
 
boolean isEqualToVersion (GDVersion version)
 Check for equality with another version. More...
 
boolean isGreaterThanVersion (GDVersion version)
 Check whether this version is more than another version. More...
 
boolean isLessThanVersion (GDVersion version)
 Check whether this version is less than another version. More...
 
String toString ()
 Dotted string representation. More...
 
int compareTo (GDVersion other)
 Compare this version with another version. More...
 

Constructor & Destructor Documentation

◆ GDVersion() [1/2]

GDVersion ( String  version)
Returns
New GDVersion object with constituent version numbers read from a dotted string representation.

◆ GDVersion() [2/2]

GDVersion ( List< Integer >  version)
Returns
New GDVersion object with constituent version numbers initialized from a List of Integer values.

Member Function Documentation

◆ numberOfVersionParts()

int numberOfVersionParts ( )
Returns
int representation of the count of how many constituent numbers there are in the version.

◆ versionPartAtPosition()

int versionPartAtPosition ( int  position)

Call this method to get one of the constituent numbers in the version, specified by a numeric position. Position zero is the major version number, which is the most significant.

Returns
The constituent version number at the specified position.

◆ isEqualToVersion()

boolean isEqualToVersion ( GDVersion  version)
Returns
true if the two versions are the same.
false Otherwise.

◆ isGreaterThanVersion()

boolean isGreaterThanVersion ( GDVersion  version)
Returns
true if this version is more than the specified version.
false Otherwise.

◆ isLessThanVersion()

boolean isLessThanVersion ( GDVersion  version)
Returns
true if this version is less than the specified version.
false Otherwise.

◆ toString()

String toString ( )
Returns
Dotted string representation of this version.

◆ compareTo()

int compareTo ( GDVersion  other)
Returns
0, 1, or -1, if this version is equal to, more than, or less than, the specified version respectively.
com.good.gd.GDVersion.GDVersion
GDVersion(String version)
Construct from a dotted string representation.
Definition: GDVersion.java:26