Package ca.uhn.hl7v2.model.primitive
Class TSComponentOne
java.lang.Object
ca.uhn.hl7v2.model.AbstractType
ca.uhn.hl7v2.model.AbstractPrimitive
ca.uhn.hl7v2.model.primitive.TSComponentOne
- All Implemented Interfaces:
Primitive,Type,Visitable,Serializable
- Direct Known Subclasses:
DTM,DTM,DTM,DTM,DTM,DTM,DTM,TS,TSComponentOne,TSComponentOne,TSComponentOne,TSComponentOne
Represents an HL7 timestamp, which is related to the HL7 TS type. In version 2.5,
TS is a composite type. The first component is type DTM, which corresponds to this class
(actually model.v25.datatype.DTM inherits from this class at time of writing). In HL7 versions
2.2-2.4, it wasn't perfectly clear whether TS was composite or primitive. HAPI interprets
it as composite, with the first component having a type that isn't defined by HL7, and we call
this type TSComponentOne. In v2.1, TS is primitive, and corresponds one-to-one with this class.
- Version:
- $Revision: 1.2 $ updated on $Date: 2011-02-21 17:55:08 $ by $Author: jamesagnew $
- Author:
- Neal Acharya, Bryan Tripp
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears all data from this typeintgetDay()Returns the day as an integer.floatReturns the fractional second value as a float.intReturns the GMT offset value as an integer.intgetHour()Returns the hour as an integer.intReturns the minute as an integer.intgetMonth()Returns the month as an integer.intReturns the second as an integer.getValue()Returns a String representation of the value of this field.Return the value as a calendar objectReturn the value as a date object Note: Sets fields using precision up to the secondintgetYear()Returns the year as an integer.booleanisEmpty()Returns true if this Visitable has actual contentvoidsetDateMinutePrecision(int yr, int mnth, int dy, int hr, int min) voidsetDatePrecision(int yr, int mnth, int dy) voidsetDateSecondPrecision(int yr, int mnth, int dy, int hr, int min, float sec) voidsetOffset(int signedOffset) voidSets the value of this Primitive, first performing validation as specified bygetMessage().getValidationContext().voidConvenience setter which sets the value using aCalendarobject.voidConvenience setter which sets the value using aCalendarobject.voidsetValueToMinute(Calendar theCalendar) Convenience setter which sets the value using aCalendarobject.voidsetValueToMinute(Date theDate) Convenience setter which sets the value using aDateobject.voidsetValueToSecond(Calendar theCalendar) Convenience setter which sets the value using aCalendarobject.voidsetValueToSecond(Date theDate) Convenience setter which sets the value using aDateobject.Methods inherited from class ca.uhn.hl7v2.model.AbstractPrimitive
accept, encode, parse, toStringMethods inherited from class ca.uhn.hl7v2.model.AbstractType
getExtraComponents, getMessage, getName, provideLocationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ca.uhn.hl7v2.model.Type
getExtraComponents, getMessage, getNameMethods inherited from interface ca.uhn.hl7v2.model.Visitable
provideLocation
-
Constructor Details
-
TSComponentOne
- Parameters:
theMessage- message to which this Type belongs
-
-
Method Details
-
setValue
Description copied from class:AbstractPrimitiveSets the value of this Primitive, first performing validation as specified bygetMessage().getValidationContext(). No validation is performed if getMessage() returns null.Note: as of the next HAPI release, the ValidationContext will be retrieved from getParser().getValidationContext(), which ultimately is the ValidationContext of the active HapiContext.
- Specified by:
setValuein interfacePrimitive- Overrides:
setValuein classAbstractPrimitive- Parameters:
theValue- the value to be set- Throws:
DataTypeException- if the value is incorrectly formatted and either validation is enabled for this primitive or detail setters / getters have been called, forcing further parsing.- See Also:
-
getValue
Description copied from interface:PrimitiveReturns a String representation of the value of this field.- Specified by:
getValuein interfacePrimitive- Overrides:
getValuein classAbstractPrimitive- Returns:
- a String representation of the value of this field
- See Also:
-
setDatePrecision
- Throws:
DataTypeException- if the value is incorrectly formatted. If validation is enabled, this exception should be thrown at setValue(), but if not, detailed parsing may be deferred until this method is called.- See Also:
-
setDateMinutePrecision
public void setDateMinutePrecision(int yr, int mnth, int dy, int hr, int min) throws DataTypeException - Throws:
DataTypeException- if the value is incorrectly formatted. If validation is enabled, this exception should be thrown at setValue(), but if not, detailed parsing may be deferred until this method is called.- See Also:
-
setDateSecondPrecision
public void setDateSecondPrecision(int yr, int mnth, int dy, int hr, int min, float sec) throws DataTypeException - Throws:
DataTypeException- if the value is incorrectly formatted. If validation is enabled, this exception should be thrown at setValue(), but if not, detailed parsing may be deferred until this method is called.- See Also:
-
setOffset
- Throws:
DataTypeException- if the value is incorrectly formatted. If validation is enabled, this exception should be thrown at setValue(), but if not, detailed parsing may be deferred until this method is called.- See Also:
-
getYear
Returns the year as an integer.- Throws:
DataTypeException- if the value is incorrectly formatted. If validation is enabled, this exception should be thrown at setValue(), but if not, detailed parsing may be deferred until this method is called.
-
getMonth
Returns the month as an integer.- Throws:
DataTypeException- if the value is incorrectly formatted. If validation is enabled, this exception should be thrown at setValue(), but if not, detailed parsing may be deferred until this method is called.
-
getDay
Returns the day as an integer.- Throws:
DataTypeException- if the value is incorrectly formatted. If validation is enabled, this exception should be thrown at setValue(), but if not, detailed parsing may be deferred until this method is called.
-
getHour
Returns the hour as an integer.- Throws:
DataTypeException- if the value is incorrectly formatted. If validation is enabled, this exception should be thrown at setValue(), but if not, detailed parsing may be deferred until this method is called.
-
getMinute
Returns the minute as an integer.- Throws:
DataTypeException- if the value is incorrectly formatted. If validation is enabled, this exception should be thrown at setValue(), but if not, detailed parsing may be deferred until this method is called.
-
getSecond
Returns the second as an integer.- Throws:
DataTypeException- if the value is incorrectly formatted. If validation is enabled, this exception should be thrown at setValue(), but if not, detailed parsing may be deferred until this method is called.
-
getFractSecond
Returns the fractional second value as a float.- Throws:
DataTypeException- if the value is incorrectly formatted. If validation is enabled, this exception should be thrown at setValue(), but if not, detailed parsing may be deferred until this method is called.
-
getGMTOffset
Returns the GMT offset value as an integer.- Throws:
DataTypeException- if the value is incorrectly formatted. If validation is enabled, this exception should be thrown at setValue(), but if not, detailed parsing may be deferred until this method is called.
-
setValue
Convenience setter which sets the value using aCalendarobject. Note: Sets fields using precision up to the millisecond, including timezone offset- Parameters:
theCalendar- The calendar object from which to retrieve values- Throws:
DataTypeException- Since:
- 1.1
-
setValue
Convenience setter which sets the value using aCalendarobject. Note: Sets fields using precision up to the millisecond, and sets the timezone offset to the current system offset Note: Date is timezone-agnostic, representing always GMT time- Parameters:
theDate- The date object from which to retrieve values- Throws:
DataTypeException- Since:
- 1.1
-
setValueToMinute
Convenience setter which sets the value using aCalendarobject. Note: Sets fields using precision up to the minute- Parameters:
theCalendar- The calendar object from which to retrieve values- Throws:
DataTypeException- Since:
- 1.1
-
setValueToMinute
Convenience setter which sets the value using aDateobject. Note: Sets fields using precision up to the minute Note: Date is timezone-agnostic, representing always GMT time- Parameters:
theDate- The date object from which to retrieve values- Throws:
DataTypeException- Since:
- 1.1
-
setValueToSecond
Convenience setter which sets the value using aCalendarobject. Note: Sets fields using precision up to the second- Parameters:
theCalendar- The calendar object from which to retrieve values- Throws:
DataTypeException- Since:
- 1.1
-
setValueToSecond
Convenience setter which sets the value using aDateobject. Note: Sets fields using precision up to the second- Parameters:
theDate- The date object from which to retrieve values- Throws:
DataTypeException- Since:
- 1.1
-
getValueAsCalendar
Return the value as a calendar object- Throws:
DataTypeException- If the current underlying string representation can not be parsed into a valid date/time- Since:
- 1.1
-
getValueAsDate
Return the value as a date object Note: Sets fields using precision up to the second- Throws:
DataTypeException- If the current underlying string representation can not be parsed into a valid date/time- Since:
- 1.1
-
isEmpty
Description copied from class:AbstractTypeReturns true if this Visitable has actual content- Specified by:
isEmptyin interfaceVisitable- Overrides:
isEmptyin classAbstractPrimitive- Returns:
- true if Visitable is empty
- Throws:
HL7Exception- if an error occurred while determining emptiness
-
clear
Description copied from class:AbstractPrimitiveClears all data from this type- Specified by:
clearin interfaceType- Overrides:
clearin classAbstractPrimitive
-