ca.uhn.hl7v2.util
Class DeepCopy

java.lang.Object
  extended by ca.uhn.hl7v2.util.DeepCopy

public class DeepCopy
extends java.lang.Object

Tools for copying data recurvisely from one message element into another. Currently only Types are supported.

Author:
Bryan Tripp

Constructor Summary
DeepCopy()
           
 
Method Summary
static void copy(Segment from, Segment to)
          Copies contents from the source segment to the destination segment.
static void copy(Type from, Type to)
          Copies data from the "from" Type into the "to" Type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeepCopy

public DeepCopy()
Method Detail

copy

public static void copy(Type from,
                        Type to)
                 throws DataTypeException
Copies data from the "from" Type into the "to" Type. Either Type may be a Primitive, Composite, or Varies. If a Varies is provided, the operation is performed on the result of calling its getData() method. A Primitive may be copied into a Composite, in which case the value is copied into the first component of the Composite. A Composite may be copied into a Primitive, in which case the first component is copied. Given Composites with different numbers of components, the first components are copied, up to the length of the smaller one.

Throws:
DataTypeException

copy

public static void copy(Segment from,
                        Segment to)
                 throws HL7Exception
Copies contents from the source segment to the destination segment. This method calls copy(Type, Type) on each repetition of each field (see additional behavioural description there). An attempt is made to copy each repetition of each field in the source segment, regardless of whether the corresponding destination field is repeating or even exists.

Parameters:
from - the segment from which data are copied
to - the segment into which data are copied
Throws:
HL7Exception


Copyright © 2001-2011 University Health Network. All Rights Reserved.