com.edustructures.sifworks
Class SIFDate

java.lang.Object
  extended by com.edustructures.sifworks.SIFSimpleType<java.util.Calendar>
      extended by com.edustructures.sifworks.SIFDate
All Implemented Interfaces:
java.io.Serializable

public class SIFDate
extends SIFSimpleType<java.util.Calendar>

Wraps a Java Calendar in an immutable instance that can be used to construct a SIFSimpleType to represent properties in SIF data objects

Version:
1.0
See Also:
Serialized Form

Constructor Summary
SIFDate(java.util.Calendar value)
          Creates an instance of SIFDate that wraps the specified Calendar value
SIFDate(java.util.Date value)
           
SIFDate(java.lang.String value)
          Deprecated. Since dates can be represented as strings in different formats across SIF Versions, please use SIFFormatter to create dates from strings and use the SIFDate(Calendar) constructor.
 
Method Summary
 java.util.Date getDate()
          Gets the date as a java.util.Date object
 SIFTypeConverter<java.util.Calendar> getTypeConverter()
          Returns a type converter that can be used to create an instance of the datatype from a string
static java.util.Calendar parseSIF1xDate(java.lang.String yyyyMMdd)
          Parse a SIFDate string into a Calendar instance
static java.util.Calendar parseSIFDateString(java.lang.String value, SIFVersion version)
          Parse a SIFDate string, using the appropriate format for the specified version of SIF
 
Methods inherited from class com.edustructures.sifworks.SIFSimpleType
createField, equals, getDataType, getSQLType, getValue, hashCode, isDoNotEncode, toString, toString, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SIFDate

public SIFDate(java.util.Calendar value)
Creates an instance of SIFDate that wraps the specified Calendar value

Parameters:
value - The Calendar value to wrap in this instance

SIFDate

public SIFDate(java.util.Date value)
Parameters:
value - The Date value to wrap. This value will be converted and stored as a calendar

SIFDate

public SIFDate(java.lang.String value)
Deprecated. Since dates can be represented as strings in different formats across SIF Versions, please use SIFFormatter to create dates from strings and use the SIFDate(Calendar) constructor.

This constructor is deprecated and will eventually be removed from the ADK. It is kept here for compatibility with the 1.5 version of the ADK. If a ParseException occurs, it will be converted to a NumberFormatException so that the String constructor doesn't change its semantics.

Parameters:
value - The SIF 1.5 formatted date to wrap in the format "yyyyMMdd"
Throws:
java.lang.NumberFormatException - if the value being set cannot be parsed into the datatype being stored for this field
Method Detail

getDate

public java.util.Date getDate()
Gets the date as a java.util.Date object

Returns:

parseSIF1xDate

public static java.util.Calendar parseSIF1xDate(java.lang.String yyyyMMdd)
Parse a SIFDate string into a Calendar instance

Parameters:
yyyyMMdd - The string representation of the date in the format "yyyyMMdd"
Returns:
a calendar instance
Throws:
java.lang.NumberFormatException - If the date cannot be parsed

parseSIFDateString

public static java.util.Calendar parseSIFDateString(java.lang.String value,
                                                    SIFVersion version)
Parse a SIFDate string, using the appropriate format for the specified version of SIF

Parameters:
value - The string value to parse into a date
version - The SIFVersion to use for parsing the string
Returns:
a Calendar instance
Throws:
java.lang.NumberFormatException - If the date cannot be parsed

getTypeConverter

public SIFTypeConverter<java.util.Calendar> getTypeConverter()
Description copied from class: SIFSimpleType
Returns a type converter that can be used to create an instance of the datatype from a string

Specified by:
getTypeConverter in class SIFSimpleType<java.util.Calendar>
Returns:
The TypeConverter that is used for this element


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.