001 package ca.uhn.hl7v2.model; 002 003 /** 004 * An unspecified segment that has an undefined number of fields, each 005 * of which is a Varies. The primary intended use is to store data from 006 * Z segments. More precisely, any unknown segment that is encountered during 007 * parsing will be handled with this class. This includes segments that do 008 * not start with Z but nevertheless do not appear in the stated version 009 * of HL7. Also, this class is not used to handle Z segments that have been 010 * explicitly defined and declared (see Parser.packageList() ). 011 * @author Bryan Tripp 012 */ 013 public class GenericSegment extends AbstractSegment { 014 015 private String name; 016 017 /** Creates a new instance of GenericSegment */ 018 public GenericSegment(Group parent, String name) { 019 super(parent, null); 020 this.name = name; 021 } 022 023 /** 024 * Returns the name specified at construction time. 025 * @see Structure#getName() 026 */ 027 public String getName() { 028 return this.name; 029 } 030 031 032 /** 033 * {@inheritDoc} 034 */ 035 protected Type createNewTypeWithoutReflection(int field) { 036 return new Varies(getMessage()); 037 } 038 039 }