View Javadoc

1   package ca.uhn.hl7v2.model;
2   
3   /**
4    * An unspecified segment that has an undefined number of fields, each 
5    * of which is a Varies.  The primary intended use is to store data from 
6    * Z segments.  More precisely, any unknown segment that is encountered during
7    * parsing will be handled with this class.  This includes segments that do 
8    * not start with Z but nevertheless do not appear in the stated version 
9    * of HL7.  Also, this class is not used to handle Z segments that have been 
10   * explicitly defined and declared (see Parser.packageList() ).  
11   * @author Bryan Tripp
12   */
13  @SuppressWarnings("serial")
14  public class GenericSegment extends AbstractSegment {
15      
16      private String name;
17  
18      /**
19       * Creates a genric segment
20       * @param parent parent group
21       * @param name name of the segment
22       */
23      public GenericSegment(Group parent, String name) {
24          super(parent, null);
25          this.name = name;
26      }
27      
28      /**
29       * Returns the name specified at construction time. 
30       * @see Structure#getName() 
31       */
32      public String getName() {
33          return this.name;
34      }
35  
36  
37      /**
38       * {@inheritDoc}
39       */
40  	protected Type createNewTypeWithoutReflection(int field) {
41  		return new Varies(getMessage());
42  	}
43      
44  }