001package ca.cdr.api.pub.hl7v2.common.abstraction; 002 003/*- 004 * #%L 005 * Smile CDR - CDR 006 * %% 007 * Copyright (C) 2016 - 2024 Smile CDR, Inc. 008 * %% 009 * All rights reserved. 010 * #L% 011 */ 012 013import ca.uhn.hl7v2.model.Group; 014import ca.uhn.hl7v2.model.v25.segment.PR1; 015 016import java.util.function.Function; 017 018import static ca.cdr.api.pub.hl7v2.common.abstraction.VisitMessage.call; 019 020public class VisitMessageProcedure<T extends Group> implements IVisitMessage.IVisitMessageProcedure { 021 022 private final T myWrappingObject; 023 private final Function<T, PR1> myPr1Function; 024 025 public VisitMessageProcedure(T theWrappingObject, Function<T, PR1> thePr1Function) { 026 myWrappingObject = theWrappingObject; 027 myPr1Function = thePr1Function; 028 } 029 030 @Override 031 public void clear() { 032 getPR1().clear(); 033 } 034 035 @Override 036 public PR1 getPR1() { 037 return call(myWrappingObject, myPr1Function); 038 } 039}