cdac.medinfo.sdk.hl7282.commoninterface

## Interface IDataType

- All Known Implementing Classes:
    AD, AUI, CCD, CCP, CD, CF, CNE, CNN, CompositeDataType, CP, CQ, CSU, CWE, CX, DDI, DIN, DLD, DLN, DLT, DR, DT, DTM, DTN, ED, EI, EIP, ERL, FC, FN, FT, GTS, HD, ICD, ID, IS, JCC, MA, MO, MOC, MOP, MSG, NA, NDL, NM, NR, OCD, OG, OSP, PIP, PL, PLN, PPN, PrimitiveDataType, PRL, PT, PTA, QIP, QSC, RCD, RFR, RI, RMC, RP, RPT, SAD, SCV, SI, SN, SNM, SPD, SRT, ST, TM, TX, UN, UVC, VH, VID, VR, WVI, WVS, XAD, XCN, XON, XPN, XTN

      public interface IDataType

  IDataType interface corresponds to needs to be implemented by all classes which implements functioning of HL7 Data Type. The methods in this interface can be used to obtain information about Data Type. Data types are basic building blocks of segment(fields). HL7 Message consists of segments.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `IDataTypeKey` | `getDataTypeName()` Returns the name of Data Type.
    `int` | `getLength()` Returns the length of Data type.
    `java.lang.Object` | `getValue()` Function returns the object of String value in case of primitive DataType.
    `boolean` | `isPrimitive()` Returns the state for Data Type whether it is primitive Data Type or composite DataType.
    `int` | `read(java.lang.String strFieldStream, IDelimiter objIDelimiter)` Reads data from the String.
    `void` | `setValue(java.lang.Object obj)` Sets the value for Data Type as object.
    `boolean` | `validate()` Validates HL7 DataType objects .
    `int` | `write(IHL7Stream objIHL7Stream, IDelimiter objIDelimiter)` Writes data to the Stream.

- - ### Method Detail

    - #### getValue

          java.lang.Object getValue()

      Function returns the object of String value in case of primitive DataType. and ISingleCollection for Composite DataType.
      Returns:
        strValue

    - #### read

          int read(java.lang.String strFieldStream,
                 IDelimiter objIDelimiter)
                   throws java.io.IOException

      Reads data from the String.
      Parameters:
        `objIHL7Stream` - - Object of IHL7Stream
        `objIDelimiter` - - Object of IDelimiter
      Returns:
        integer - Number of bytes read - Fail if data read is not valid
      Throws:
        `java.io.IOException` - Thrown when any IO Operation fails

    - #### write

          int write(IHL7Stream objIHL7Stream,
                  IDelimiter objIDelimiter)
                    throws java.io.IOException

      Writes data to the Stream.
      Parameters:
        `objIHL7Stream` - - Object of IHL7Stream
        `objIDelimiter` - - Object of IDelimiter
      Returns:
        the integer value depending on the result
      Throws:
        `java.io.IOException` - Thrown when any IO Operation fails

    - #### validate

          boolean validate()

      Validates HL7 DataType objects . Validate method checks for validation each and every component for composite DataType and String value in side the DataType object against specified HL7 Rules. Validation checks include length of Data Type.(Upper bound and Lower bound. It also checks that given value matches with specifications said by HL7 DataType.
      Returns:
        boolean - true or false
      Throws:
        `InvalidDataTypeException` - Throws when DataType Validation fails

    - #### setValue

          void setValue(java.lang.Object obj)

      Sets the value for Data Type as object. For composite Data Type it will set the MultivaluedPairedCollection for primitive Data Type it will set the String. if it is not as per the expectation then it will not set the value.

    - #### getLength

          int getLength()

      Returns the length of Data type.

    - #### isPrimitive

          boolean isPrimitive()

      Returns the state for Data Type whether it is primitive Data Type or composite DataType.
      Returns:
        true In case of Primitive DataType else false

    - #### getDataTypeName

          IDataTypeKey getDataTypeName()

      Returns the name of Data Type.
      Returns:
        IDataTypeKey - Name of the Data Type