001package ca.uhn.hl7v2.parser;
002
003import ca.uhn.hl7v2.HL7Exception;
004import ca.uhn.hl7v2.model.Message;
005
006/**
007 * Defines the behaviour to use when an unexpected
008 * segment is discovered while parsing a message.
009 * 
010 * @see ParserConfiguration#setUnexpectedSegmentBehaviour(UnexpectedSegmentBehaviourEnum)
011 */
012public enum UnexpectedSegmentBehaviourEnum {
013
014        /**
015         * <p>
016         * Add the segment as a 
017         * {@link Message#addNonstandardSegment(String) nonstandard segment}
018         * at the current location, even if the current location is in a 
019         * child group within the message.
020         * </p>
021         * <p>
022         * This is the default.
023         * </p>
024         */
025        ADD_INLINE,
026
027        /**
028         * Return the parser back to the root of the message (even if the last
029         * segment was in a group) and add the unexpected segment as a
030         * {@link Message#addNonstandardSegment(String) nonstandard segment}.
031         */
032        DROP_TO_ROOT,
033
034        /**
035         * Throw an {@link HL7Exception}
036         */
037        THROW_HL7_EXCEPTION
038}