com.edustructures.sifworks
Class SIFVersion

java.lang.Object
  extended by com.edustructures.sifworks.SIFVersion
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<SIFVersion>

public class SIFVersion
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable<SIFVersion>

Encapsulates a SIF version number.

The ADK uses instances of SIFVersion rather than strings to identify versions of SIF. Typically you do not need to obtain a SIFVersion instance directly except for when initializing the class framework with the ADK.initialize method. Rather, classes for which SIF version is a property, such as SIFDataObject and Query, provide a getSIFVersion method to obtain the version associated with an object.

Version:
1.0
See Also:
Serialized Form

Field Summary
static SIFVersion LATEST
          Identifies the latest SIF Specification supported by the SIFWorks ADK
static SIFVersion SIF11
          Identifies the SIF 1.1 Specification
static SIFVersion SIF15r1
          Identifies the SIF 1.5r1 Specification
static SIFVersion SIF20
          Identifies the SIF 2.0 Specification
static SIFVersion SIF20r1
          Identifies the SIF 2.0r1 Specification
static SIFVersion SIF21
          Identifies the SIF 2.1 Specification
 
Method Summary
 int compareTo(SIFVersion version)
          Compare this version to another
static SIFVersion getLatest(int major)
          Returns the latest SIFVersion supported by the ADK for the major version number of SIF specified.
 int getMajor()
          Gets the major version number
 int getMinor()
          Gets the minor version number
 int getRevision()
          Gets the revision number
 java.lang.String getXmlns()
          Get the SIF namespace for this version of the specification.
static SIFVersion parse(java.lang.String versionStr)
          Parse a SIFVersion from a string
static SIFVersion parseXmlns(java.lang.String xmlns)
          Parse a SIFVersion from a xmlns attribute value
 java.lang.String toString()
          Gets the string representation of the version
 java.lang.String toSymbol()
          Gets the string representation of the version using an underscore instead of a period as the delimiter
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SIF11

public static final SIFVersion SIF11
Identifies the SIF 1.1 Specification


SIF15r1

public static final SIFVersion SIF15r1
Identifies the SIF 1.5r1 Specification


SIF20

public static final SIFVersion SIF20
Identifies the SIF 2.0 Specification


SIF20r1

public static final SIFVersion SIF20r1
Identifies the SIF 2.0r1 Specification


SIF21

public static final SIFVersion SIF21
Identifies the SIF 2.1 Specification


LATEST

public static final SIFVersion LATEST
Identifies the latest SIF Specification supported by the SIFWorks ADK

Method Detail

getMajor

public int getMajor()
Gets the major version number

Returns:
the major version number of this SIFVersion

getMinor

public int getMinor()
Gets the minor version number

Returns:
the minor version number of this SIFVersion

getRevision

public int getRevision()
Gets the revision number

Returns:
The revision number of this SIFVersion

parse

public static SIFVersion parse(java.lang.String versionStr)
Parse a SIFVersion from a string

Parameters:
versionStr - A version string in the format "1.0r1"
Returns:
A SIFVersion instance encapsulating the version string
Throws:
java.lang.IllegalArgumentException - is thrown if the version string is invalid

getLatest

public static SIFVersion getLatest(int major)
Returns the latest SIFVersion supported by the ADK for the major version number of SIF specified. For example, passing the value 1 returns SIFVersion.15r1

Parameters:
major -
Returns:
The latest version of SIF that the ADK supports for the specified major version.

parseXmlns

public static SIFVersion parseXmlns(java.lang.String xmlns)
Parse a SIFVersion from a xmlns attribute value

If the xmlns attribute is in the form "http://www.sifinfo.org/v1.0r1/messages", the version identified by the namespace is returned (e.g. "1.0r1"). If the xmlns attribute is in the form "http://www.sifinfo.org/infrastructure/1.x", the latest version of SIF identified by the major version number is returned.

Parameters:
xmlns - A SIF xmlns attribute value (e.g. "http://www.sifinfo.org/v1.0r1/messages", "http://www.sifinfo.org/infrastructure/1x.", etc)
Returns:
A SIFVersion object encapsulating the version of SIF identified by the xmlns value, or null if the xmlns is invalid

getXmlns

public java.lang.String getXmlns()
Get the SIF namespace for this version of the specification.

Returns:
If the SIFVersion is less than SIF 1.1, a namespace in the form "http://www.sifinfo.org/v1.0r2/messages" is returned, where the full SIF Version number is included in the namespace. For SIF 1.x and later, a namespace in the form "http://www.sifinfo.org/infrastructure/1.x" is returned, where only the major version number is included in the namespace.

compareTo

public int compareTo(SIFVersion version)
Compare this version to another

Specified by:
compareTo in interface java.lang.Comparable<SIFVersion>
Parameters:
version - The version to compare
Returns:
-1 if this version is earlier than version, 0 if the versions are equal, or 1 if this version is greater than version or version is null.

toString

public java.lang.String toString()
Gets the string representation of the version

Overrides:
toString in class java.lang.Object
Returns:
The tag passed to the constructor. If null, a version in the form major.minorrrevision is returned with no padding.

toSymbol

public java.lang.String toSymbol()
Gets the string representation of the version using an underscore instead of a period as the delimiter

Returns:
This SIFVersion in symbol format (e.g. 1_5r1)


Copyright © 2001-2007 Edustructures LLC. All Rights Reserved. SIFWorks® and ADK® are registered trademarks of Edustructures LLC. SIF™ and Schools Interoperability Framework are trademarks of the Schools Interoperability Framework Association.