View Javadoc
1   package ca.uhn.fhir.model.api;
2   
3   /*
4    * #%L
5    * HAPI FHIR - Core Library
6    * %%
7    * Copyright (C) 2014 - 2019 University Health Network
8    * %%
9    * Licensed under the Apache License, Version 2.0 (the "License");
10   * you may not use this file except in compliance with the License.
11   * You may obtain a copy of the License at
12   * 
13   *      http://www.apache.org/licenses/LICENSE-2.0
14   * 
15   * Unless required by applicable law or agreed to in writing, software
16   * distributed under the License is distributed on an "AS IS" BASIS,
17   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18   * See the License for the specific language governing permissions and
19   * limitations under the License.
20   * #L%
21   */
22  
23  import org.hl7.fhir.instance.model.api.IBaseDatatype;
24  
25  import java.util.List;
26  
27  public interface ISupportsUndeclaredExtensions extends IElement {
28  	
29  	/**
30  	 * Returns a list containing all undeclared non-modifier extensions. The returned list
31  	 * is mutable, so it may be modified (e.g. to add or remove an extension).
32  	 */
33  	List<ExtensionDt> getUndeclaredExtensions();
34  
35  	/**
36  	 * Returns an <b>immutable</b> list containing all undeclared extensions (modifier and non-modifier) by extension URL
37  	 * 
38  	 * @see #getUndeclaredExtensions() To return a mutable list which may be used to remove extensions
39  	 */
40  	List<ExtensionDt> getUndeclaredExtensionsByUrl(String theUrl);
41  
42  	/**
43  	 * Returns an <b>immutable</b> list containing all extensions (modifier and non-modifier).
44  	 * 
45  	 * @see #getUndeclaredExtensions() To return a mutable list which may be used to remove undeclared non-modifier extensions
46  	 * @see #getUndeclaredModifierExtensions() To return a mutable list which may be used to remove undeclared modifier extensions
47  	 */
48  	List<ExtensionDt> getAllUndeclaredExtensions();
49  
50  	/**
51  	 * Returns a list containing all undeclared modifier extensions. The returned list
52  	 * is mutable, so it may be modified (e.g. to add or remove an extension).
53  	 */
54  	List<ExtensionDt> getUndeclaredModifierExtensions();
55  	
56  	/**
57  	 * Adds an extension to this object. This extension should have the
58  	 * following properties set:
59  	 * <ul>
60  	 * <li>{@link ExtensionDt#setModifier(boolean) Is Modifier}</li>
61  	 * <li>{@link ExtensionDt#setUrl(String) URL}</li>
62  	 * <li>And one of:
63  	 * <ul>
64  	 * <li>{@link ExtensionDt#setValue(IBaseDatatype) A datatype value}</li>
65  	 * <li>{@link #addUndeclaredExtension(ExtensionDt) Further sub-extensions}</li>
66  	 * </ul>
67  	 * </ul> 
68  	 * 
69  	 * @param theExtension The extension to add. Can not be null.
70  	 */
71  	void addUndeclaredExtension(ExtensionDt theExtension);
72  	
73  	/**
74  	 * Adds an extension to this object
75  	 * 
76  	 * @see #getUndeclaredExtensions() To return a mutable list which may be used to remove extensions
77  	 */
78  	ExtensionDt addUndeclaredExtension(boolean theIsModifier, String theUrl, IBaseDatatype theValue);
79  
80  	/**
81  	 * Adds an extension to this object. This method is intended for use when
82  	 * an extension is being added which will contain child extensions, as opposed to
83  	 * a datatype.
84  	 * 
85  	 * @see #getUndeclaredExtensions() To return a mutable list which may be used to remove extensions
86  	 */
87  	ExtensionDt addUndeclaredExtension(boolean theIsModifier, String theUrl);
88  
89  }