|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectca.uhn.hl7v2.model.primitive.CommonDT
public class CommonDT
This class contains functionality used by the DT class in the version 2.3.0, 2.3.1, and 2.4 packages Note: The class description below has been excerpted from the Hl7 2.4 documentation. Sectional references made below also refer to the same documentation. Format: YYYY[MM[DD]] In prior versions of HL7, this data type was always specified to be in the format YYYYMMDD. In the current and future versions, the precision of a date may be expressed by limiting the number of digits used with the format specification YYYY[MM[DD]]. Thus, YYYY is used to specify a precision of "year," YYYYMM specifies a precision of "month," and YYYYMMDD specifies a precision of "day." By site-specific agreement, YYYYMMDD may be used where backward compatibility must be maintained. Examples: |19880704| |199503|
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CommonDT()
public CommonDT(String val)
throws DataTypeException
DataTypeException| Method Detail |
|---|
public void setValue(Calendar theCalendar)
throws DataTypeException
Calendar object. Passing in null clears any existing value.
Note: Sets fields using maximum possible precision
theCalendar - The calendar object from which to retrieve values
DataTypeException
public void setValue(Date theDate)
throws DataTypeException
Date object. Passing in null clears any existing value.
Note: Sets fields using maximum possible precision
theCalendar - The calendar object from which to retrieve values
DataTypeExceptionpublic 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
DataTypeExceptionpublic String getValue()
public int getYear()
public int getMonth()
public int getDay()
public static String toHl7DTFormat(GregorianCalendar cal)
throws DataTypeException
DataTypeException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||