1 package ca.uhn.fhir.model.api;
2
3 /*
4 * #%L
5 * HAPI FHIR - Core Library
6 * %%
7 * Copyright (C) 2014 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 java.util.List;
24
25 public interface ISupportsUndeclaredExtensions extends IElement {
26
27 /**
28 * Returns a list containing all undeclared non-modifier extensions
29 */
30 List<ExtensionDt> getUndeclaredExtensions();
31
32 /**
33 * Returns a list containing all undeclared extensions (modifier and non-modifier) by extension URL
34 */
35 List<ExtensionDt> getUndeclaredExtensionsByUrl(String theUrl);
36
37 /**
38 * Returns an <b>immutable</b> list containing all extensions (modifier and non-modifier)
39 */
40 List<ExtensionDt> getAllUndeclaredExtensions();
41
42 /**
43 * Returns a list containing all undeclared modifier extensions
44 */
45 List<ExtensionDt> getUndeclaredModifierExtensions();
46
47 /**
48 * Adds an extension to this object. This extension should have the
49 * following properties set:
50 * <ul>
51 * <li>{@link ExtensionDt#setModifier(boolean) Is Modifier}</li>
52 * <li>{@link ExtensionDt#setUrl(String) URL}</li>
53 * <li>And one of:
54 * <ul>
55 * <li>{@link ExtensionDt#setValue(IElement) A datatype value}</li>
56 * <li>{@link #addUndeclaredExtension(ExtensionDt) Further sub-extensions}</li>
57 * </ul>
58 * </ul>
59 *
60 * @param theExtension The extension to add. Can not be null.
61 */
62 void addUndeclaredExtension(ExtensionDt theExtension);
63
64 /**
65 * Adds an extension to this object
66 */
67 ExtensionDt addUndeclaredExtension(boolean theIsModifier, String theUrl, IDatatype theValue);
68
69 /**
70 * Adds an extension to this object. This method is intended for use when
71 * an extension is being added which will contain child extensions, as opposed to
72 * a datatype.
73 */
74 ExtensionDt addUndeclaredExtension(boolean theIsModifier, String theUrl);
75
76 }