class RecipientTransformer {

    public Recipient fromEbXML(String slotValue) {
        if (slotValue == null || slotValue.isEmpty()) {
            return null;
        }
        
        Recipient recipient = new Recipient();

        String[] parts = slotValue.split("\\|");
        recipient.setOrganization(Hl7v2Based.parse(parts[0], Organization.class));
        if (parts.length > 1) {
            recipient.setPerson(Hl7v2Based.parse(parts[1], Person.class));
        }
        if (parts.length > 2) {
            recipient.setTelecom(Hl7v2Based.parse(parts[2], Telecom.class));
        }

        return recipient;
    }

}