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.v25.segment.IN1; 014import ca.uhn.hl7v2.model.v25.segment.IN2; 015 016import java.util.function.Function; 017 018public class VisitMessageInsurance<T> implements IVisitMessage.IVisitMessageInsurance { 019 020 private final T myWrappingObject; 021 private final Function<T, IN1> myIn1Function; 022 private final Function<T, IN2> myIn2Function; 023 024 public VisitMessageInsurance( 025 T theWrappingObject, Function<T, IN1> theIn1Function, Function<T, IN2> theIn2Function) { 026 myWrappingObject = theWrappingObject; 027 myIn1Function = theIn1Function; 028 myIn2Function = theIn2Function; 029 } 030 031 @Override 032 public IN1 getIN1() { 033 return myIn1Function.apply(myWrappingObject); 034 } 035 036 @Override 037 public IN2 getIN2() { 038 return myIn2Function.apply(myWrappingObject); 039 } 040}