Coverage Report - ca.uhn.hl7v2.model.DelegatingMessageVisitor
 
Classes in this File Line Coverage Branch Coverage Complexity
DelegatingMessageVisitor
100%
16/16
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 "DelegatingMessageVisitor.java ".  Description:
 10  
  "Delegating visitor base class"
 11  
 
 12  
  The Initial Developer of the Original Code is University Health Network. Copyright (C)
 13  
  2013.  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  
 package ca.uhn.hl7v2.model;
 28  
 
 29  
 import ca.uhn.hl7v2.HL7Exception;
 30  
 import ca.uhn.hl7v2.Location;
 31  
 
 32  
 import org.slf4j.Logger;
 33  
 import org.slf4j.LoggerFactory;
 34  
 
 35  
 /**
 36  
  * Delegates all visit method calls to the wrapped MessageVisitor. This class can be used
 37  
  */
 38  
 public class DelegatingMessageVisitor<T extends MessageVisitor> implements MessageVisitor {
 39  
 
 40  
     private T delegate;
 41  5
     protected static final Logger LOG = LoggerFactory.getLogger(DelegatingMessageVisitor.class);
 42  
 
 43  
     /**
 44  
      * @param delegate MessageVisitor to which all calls are delegated to
 45  
      */
 46  5
     public DelegatingMessageVisitor(T delegate) {
 47  5
         this.delegate = delegate;
 48  5
     }
 49  
 
 50  
     /**
 51  
      * @return MessageVisitor to which all calls are delegated to
 52  
      */
 53  
     public T getDelegate() {
 54  5
         return delegate;
 55  
     }
 56  
 
 57  
     public boolean start(Message message) throws HL7Exception {
 58  5
         return delegate.start(message);
 59  
     }
 60  
 
 61  
     public boolean end(Message message) throws HL7Exception {
 62  5
         return delegate.end(message);
 63  
     }
 64  
 
 65  
     public boolean start(Group group, Location location) throws HL7Exception {
 66  25
         return delegate.start(group, location);
 67  
     }
 68  
 
 69  
     public boolean end(Group group, Location location) throws HL7Exception {
 70  25
         return delegate.end(group, location);
 71  
     }
 72  
 
 73  
     public boolean start(Segment segment, Location location) throws HL7Exception {
 74  45
         return delegate.start(segment, location);
 75  
     }
 76  
 
 77  
     public boolean end(Segment segment, Location location) throws HL7Exception {
 78  45
         return delegate.end(segment, location);
 79  
     }
 80  
 
 81  
     public boolean start(Field field, Location location) throws HL7Exception {
 82  860
         return delegate.start(field, location);
 83  
     }
 84  
 
 85  
     public boolean end(Field Field, Location location) throws HL7Exception {
 86  860
         return delegate.end(Field, location);
 87  
     }
 88  
     
 89  
     public boolean start(Composite type, Location location) throws HL7Exception {
 90  120
         return delegate.start(type, location);
 91  
     }
 92  
 
 93  
     public boolean end(Composite type, Location location) throws HL7Exception {
 94  120
         return delegate.end(type, location);
 95  
     }
 96  
 
 97  
     public boolean visit(Primitive type, Location location) throws HL7Exception {
 98  220
         return delegate.visit(type, location);
 99  
     }
 100  
 
 101  
 }