public class CommonDT extends Object implements Serializable
Constructor and Description |
---|
CommonDT()
Constructs a DT datatype with fields initialzed to zero and value initialized
to null.
|
CommonDT(String val)
Constructs a DT object with the given value.
|
Modifier and Type | Method and Description |
---|---|
int |
getDay()
Returns the day as an integer.
|
int |
getMonth()
Returns the month as an integer.
|
String |
getValue()
Returns the HL7 DT string value.
|
Calendar |
getValueAsCalendar()
Return the value as a calendar object
|
Date |
getValueAsDate()
Return the value as a date object
|
int |
getYear()
Returns the year as an integer.
|
void |
setValue(Calendar theCalendar)
Convenience setter which sets the value using a
Calendar object. |
void |
setValue(Date theDate)
Convenience setter which sets the value using a
Date object. |
void |
setValue(String val)
This method takes in a string HL7 date value and performs validations
then sets the value field.
|
void |
setYearMonthDayPrecision(int yr,
int mnth,
int dy)
This method takes in integer values for the year and month and day
and performs validations, it then sets the value in the object
formatted as an HL7 date value with year&month&day precision (YYYYMMDD).
|
void |
setYearMonthPrecision(int yr,
int mnth)
This method takes in integer values for the year and month and performs validations,
it then sets the value field formatted as an HL7 date
value with year&month precision (YYYYMM).
|
void |
setYearPrecision(int yr)
This method takes in an integer value for the year and performs validations,
it then sets the value field formatted as an HL7 date.
|
static String |
toHl7DTFormat(GregorianCalendar cal)
Returns a string value representing the input Gregorian Calendar object in
an Hl7 Date Format.
|
public CommonDT()
public CommonDT(String val) throws DataTypeException
DataTypeException
public void setValue(Calendar theCalendar) throws DataTypeException
Calendar
object. Passing in null
clears any existing value.
Note: Sets fields using maximum possible precisiontheCalendar
- The calendar object from which to retrieve valuesDataTypeException
public void setValue(Date theDate) throws DataTypeException
Date
object. Passing in null
clears any existing value.
Note: Sets fields using maximum possible precisiontheDate
- The date object from which to retrieve valuesDataTypeException
public Calendar getValueAsCalendar()
public Date getValueAsDate()
public void setValue(String val) throws DataTypeException
null
clears any existing value.DataTypeException
public void setYearPrecision(int yr) throws DataTypeException
DataTypeException
public void setYearMonthPrecision(int yr, int mnth) throws DataTypeException
DataTypeException
public void setYearMonthDayPrecision(int yr, int mnth, int dy) throws DataTypeException
DataTypeException
public int getYear()
public int getMonth()
public int getDay()
public static String toHl7DTFormat(GregorianCalendar cal) throws DataTypeException
DataTypeException
Copyright © 2001–2017 University Health Network. All rights reserved.