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    @SuppressWarnings("serial")
014    public class GenericSegment extends AbstractSegment {
015        
016        private String name;
017        
018        /** Creates a new instance of GenericSegment */
019        public GenericSegment(Group parent, String name) {
020            super(parent, null);
021            this.name = name;
022        }
023        
024        /**
025         * Returns the name specified at construction time. 
026         * @see Structure#getName() 
027         */
028        public String getName() {
029            return this.name;
030        }
031    
032    
033        /**
034         * {@inheritDoc}
035         */
036            protected Type createNewTypeWithoutReflection(int field) {
037                    return new Varies(getMessage());
038            }
039        
040    }