001package ca.uhn.fhir.model.api; 002 003/* 004 * #%L 005 * HAPI FHIR - Core Library 006 * %% 007 * Copyright (C) 2014 - 2017 University Health Network 008 * %% 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 * #L% 021 */ 022 023import java.util.List; 024 025import org.hl7.fhir.instance.model.api.IBaseDatatype; 026 027public interface ISupportsUndeclaredExtensions extends IElement { 028 029 /** 030 * Returns a list containing all undeclared non-modifier extensions. The returned list 031 * is mutable, so it may be modified (e.g. to add or remove an extension). 032 */ 033 List<ExtensionDt> getUndeclaredExtensions(); 034 035 /** 036 * Returns an <b>immutable</b> list containing all undeclared extensions (modifier and non-modifier) by extension URL 037 * 038 * @see #getUndeclaredExtensions() To return a mutable list which may be used to remove extensions 039 */ 040 List<ExtensionDt> getUndeclaredExtensionsByUrl(String theUrl); 041 042 /** 043 * Returns an <b>immutable</b> list containing all extensions (modifier and non-modifier). 044 * 045 * @see #getUndeclaredExtensions() To return a mutable list which may be used to remove extensions 046 */ 047 List<ExtensionDt> getAllUndeclaredExtensions(); 048 049 /** 050 * Returns a list containing all undeclared modifier extensions. The returned list 051 * is mutable, so it may be modified (e.g. to add or remove an extension). 052 */ 053 List<ExtensionDt> getUndeclaredModifierExtensions(); 054 055 /** 056 * Adds an extension to this object. This extension should have the 057 * following properties set: 058 * <ul> 059 * <li>{@link ExtensionDt#setModifier(boolean) Is Modifier}</li> 060 * <li>{@link ExtensionDt#setUrl(String) URL}</li> 061 * <li>And one of: 062 * <ul> 063 * <li>{@link ExtensionDt#setValue(IBaseDatatype) A datatype value}</li> 064 * <li>{@link #addUndeclaredExtension(ExtensionDt) Further sub-extensions}</li> 065 * </ul> 066 * </ul> 067 * 068 * @param theExtension The extension to add. Can not be null. 069 */ 070 void addUndeclaredExtension(ExtensionDt theExtension); 071 072 /** 073 * Adds an extension to this object 074 * 075 * @see #getUndeclaredExtensions() To return a mutable list which may be used to remove extensions 076 */ 077 ExtensionDt addUndeclaredExtension(boolean theIsModifier, String theUrl, IBaseDatatype theValue); 078 079 /** 080 * Adds an extension to this object. This method is intended for use when 081 * an extension is being added which will contain child extensions, as opposed to 082 * a datatype. 083 * 084 * @see #getUndeclaredExtensions() To return a mutable list which may be used to remove extensions 085 */ 086 ExtensionDt addUndeclaredExtension(boolean theIsModifier, String theUrl); 087 088}