001/* 002 * #%L 003 * HAPI FHIR Structures - DSTU2 (FHIR v1.0.0) 004 * %% 005 * Copyright (C) 2014 - 2023 Smile CDR, Inc. 006 * %% 007 * Licensed under the Apache License, Version 2.0 (the "License"); 008 * you may not use this file except in compliance with the License. 009 * You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 * #L% 019 */ 020package ca.uhn.fhir.model.dstu2.composite; 021 022import ca.uhn.fhir.i18n.Msg; 023import java.util.ArrayList; 024import java.util.List; 025 026import ca.uhn.fhir.model.api.IDatatype; 027import ca.uhn.fhir.model.api.IResource; 028import ca.uhn.fhir.model.api.annotation.Child; 029import ca.uhn.fhir.model.api.annotation.DatatypeDef; 030import ca.uhn.fhir.model.base.composite.BaseContainedDt; 031 032@DatatypeDef(name = "contained") 033public class ContainedDt extends BaseContainedDt { 034 035 @Child(name = "resource", type = IResource.class, order = 0, min = 0, max = Child.MAX_UNLIMITED) 036 private List<IResource> myContainedResources; 037 038 @Override 039 public List<IResource> getContainedResources() { 040 if (myContainedResources == null) { 041 myContainedResources = new ArrayList<IResource>(); 042 } 043 return myContainedResources; 044 } 045 046 public void setContainedResources(List<IResource> theContainedResources) { 047 myContainedResources = theContainedResources; 048 } 049 050 @Override 051 public boolean isEmpty() { 052 return myContainedResources == null || myContainedResources.size() == 0; 053 } 054 055 @Override 056 public Object getUserData(String theName) { 057 throw new UnsupportedOperationException(Msg.code(580)); 058 } 059 060 @Override 061 public void setUserData(String theName, Object theValue) { 062 throw new UnsupportedOperationException(Msg.code(581)); 063 } 064 065}