Coverage Report - ca.uhn.hl7v2.model.Type
 
Classes in this File Line Coverage Branch Coverage Complexity
Type
N/A
N/A
1
 
 1  
 /**
 2  
 The contents of this file are subject to the Mozilla Public License Version 1.1 
 3  
 (the "License"); you may not use this file except in compliance with the License. 
 4  
 You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
 5  
 Software distributed under the License is distributed on an "AS IS" basis, 
 6  
 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
 7  
 specific language governing rights and limitations under the License. 
 8  
 
 9  
 The Original Code is "Type.java".  Description: 
 10  
 "An HL7 datatype" 
 11  
 
 12  
 The Initial Developer of the Original Code is University Health Network. Copyright (C) 
 13  
 2001.  All Rights Reserved. 
 14  
 
 15  
 Contributor(s): ______________________________________. 
 16  
 
 17  
 Alternatively, the contents of this file may be used under the terms of the 
 18  
 GNU General Public License (the  �GPL�), in which case the provisions of the GPL are 
 19  
 applicable instead of those above.  If you wish to allow use of your version of this 
 20  
 file only under the terms of the GPL and not to allow others to use your version 
 21  
 of this file under the MPL, indicate your decision by deleting  the provisions above 
 22  
 and replace  them with the notice and other provisions required by the GPL License.  
 23  
 If you do not delete the provisions above, a recipient may use your version of 
 24  
 this file under either the MPL or the GPL. 
 25  
 
 26  
 */
 27  
 
 28  
 package ca.uhn.hl7v2.model;
 29  
 
 30  
 import ca.uhn.hl7v2.HL7Exception;
 31  
 import java.io.Serializable;
 32  
 
 33  
 /**
 34  
  * An HL7 datatype.  Datatypes normally implement either Composite or Primitive.    
 35  
  * @author Bryan Tripp (bryan_tripp@sourceforge.net)
 36  
  */
 37  
 public interface Type extends Serializable {
 38  
 
 39  
     /** Returns the name of the type (used in XML encoding and profile checking) */
 40  
     public String getName();
 41  
     
 42  
     /**
 43  
      * Returns an object containing any extra (non-standard) components that 
 44  
      * have been added to this type at run-time.  This object can also be used
 45  
      * to add components.  
 46  
      */
 47  
     public ExtraComponents getExtraComponents();
 48  
     
 49  
     /**
 50  
      * @return the message to which this Type belongs
 51  
      */
 52  
     public Message getMessage();
 53  
 
 54  
     /**
 55  
      * <p>
 56  
      * Parses the string into this type and replaces the current contents with
 57  
      * the parsed value. This method accepts HL7 encoded text and treats its
 58  
      * input as such.
 59  
      * </p>
 60  
      * <p>
 61  
      * Note that this method is subtly different from calling {@link Primitive#setValue(String)}, but
 62  
      * can be quite powerful. For example, using the argument of "milk&cookies" on an ST datatype:
 63  
      * <ul>
 64  
      * <li>
 65  
      * If you are using {@link Primitive#setValue(String)}, the ampersand is treated as an actual ampersand 
 66  
      * in the text, and the field will be treated as a single field which is encoded as "milk\T\cookies" (\T\ is the 
 67  
      * escape sequence for the subcomponent delimiter).
 68  
      * </li>
 69  
      * <li>
 70  
      * If you are using parse(String), the ampersand is treated as a subcomponent delimiter, meaning that
 71  
      * the value is set to "milk", and a second component is added with the value of "cookies".
 72  
      * </li>
 73  
      * </ul>
 74  
      * </p>  
 75  
      * <p>
 76  
      * This method makes use of the parser which is stored within the enclosing {@link #getMessage() Message}.
 77  
      * At this time, only PipeParsers are supported. 
 78  
      * </p>
 79  
      */
 80  
     public void parse(String string) throws HL7Exception;
 81  
 
 82  
 
 83  
     /**
 84  
      * Encodes this type using HL7 encoding.
 85  
      */
 86  
     public String encode() throws HL7Exception;
 87  
 
 88  
 
 89  
         /**
 90  
          * Clears all data from this type
 91  
          */
 92  
         void clear();
 93  
         
 94  
         /**
 95  
          * Does this type have any actual content
 96  
          */
 97  
         boolean isEmpty();
 98  
 }