- * Thread safety: Parsers are not guaranteed to be thread safe. Create a new parser instance for every thread
- * or every message being parsed/encoded.
- *
- *
- * Performance Note: This method is cheap to call, and may be called once for every message being processed
- * without incurring any performance penalty
- *
- *
- * The NDJsonParser provided here is expected to translate between legal NDJson and FHIR Bundles.
- * In particular, it is able to encode the resources in a FHIR Bundle to NDJson, as well as decode
- * NDJson into a FHIR "collection"-type Bundle populated with the resources described in the NDJson.
- * It will throw an exception in the event where it is asked to encode to anything other than a FHIR Bundle
- * or where it is asked to decode into anything other than a FHIR Bundle.
- *
- */
- public IParser newNDJsonParser() {
- return new NDJsonParser(this, myParserErrorHandler);
- }
+ /**
+ * Create and return a new NDJSON parser.
+ *
+ *
+ * Thread safety: Parsers are not guaranteed to be thread safe. Create a new parser instance for every thread
+ * or every message being parsed/encoded.
+ *
+ *
+ * Performance Note: This method is cheap to call, and may be called once for every message being processed
+ * without incurring any performance penalty
+ *
+ *
+ * The NDJsonParser provided here is expected to translate between legal NDJson and FHIR Bundles.
+ * In particular, it is able to encode the resources in a FHIR Bundle to NDJson, as well as decode
+ * NDJson into a FHIR "collection"-type Bundle populated with the resources described in the NDJson.
+ * It will throw an exception in the event where it is asked to encode to anything other than a FHIR Bundle
+ * or where it is asked to decode into anything other than a FHIR Bundle.
+ *
+ */
+ public IParser newNDJsonParser() {
+ return new NDJsonParser(this, myParserErrorHandler);
+ }
/**
* Create and return a new RDF parser.
@@ -1005,7 +1035,8 @@ public class FhirContext {
return (RuntimeResourceDefinition) defs.get(theResourceType);
}
- private synchronized Map, BaseRuntimeElementDefinition>> scanResourceTypes(final Collection> theResourceTypes) {
+ private synchronized Map, BaseRuntimeElementDefinition>> scanResourceTypes(
+ final Collection> theResourceTypes) {
List> typesToScan = new ArrayList<>();
if (theResourceTypes != null) {
typesToScan.addAll(theResourceTypes);
@@ -1022,7 +1053,8 @@ public class FhirContext {
Map> nameToElementDefinition = new HashMap<>();
nameToElementDefinition.putAll(myNameToElementDefinition);
- for (Entry> next : scanner.getNameToElementDefinitions().entrySet()) {
+ for (Entry> next :
+ scanner.getNameToElementDefinitions().entrySet()) {
if (!nameToElementDefinition.containsKey(next.getKey())) {
nameToElementDefinition.put(next.getKey().toLowerCase(), next.getValue());
}
@@ -1030,7 +1062,8 @@ public class FhirContext {
Map nameToResourceDefinition = new HashMap<>();
nameToResourceDefinition.putAll(myNameToResourceDefinition);
- for (Entry next : scanner.getNameToResourceDefinition().entrySet()) {
+ for (Entry next :
+ scanner.getNameToResourceDefinition().entrySet()) {
if (!nameToResourceDefinition.containsKey(next.getKey())) {
nameToResourceDefinition.put(next.getKey(), next.getValue());
}
@@ -1043,7 +1076,8 @@ public class FhirContext {
if (next instanceof RuntimeResourceDefinition) {
if ("Bundle".equals(next.getName())) {
if (!IBaseBundle.class.isAssignableFrom(next.getImplementingClass())) {
- throw new ConfigurationException(Msg.code(1687) + "Resource type declares resource name Bundle but does not implement IBaseBundle");
+ throw new ConfigurationException(Msg.code(1687)
+ + "Resource type declares resource name Bundle but does not implement IBaseBundle");
}
}
}
@@ -1111,7 +1145,8 @@ public class FhirContext {
}
@SuppressWarnings({"cast"})
- private List> toElementList(final Collection> theResourceTypes) {
+ private List> toElementList(
+ final Collection> theResourceTypes) {
if (theResourceTypes == null) {
return null;
}
@@ -1146,13 +1181,15 @@ public class FhirContext {
}
public IPrimitiveType newPrimitiveBoolean(Boolean theValue) {
- IPrimitiveType retval = (IPrimitiveType) getElementDefinition("boolean").newInstance();
+ IPrimitiveType retval =
+ (IPrimitiveType) getElementDefinition("boolean").newInstance();
retval.setValue(theValue);
return retval;
}
- public IPrimitiveType newPrimitiveString(String theValue) {
- IPrimitiveType retval = (IPrimitiveType) getElementDefinition("string").newInstance();
+ public IPrimitiveType newPrimitiveString(String theValue) {
+ IPrimitiveType retval =
+ (IPrimitiveType) getElementDefinition("string").newInstance();
retval.setValue(theValue);
return retval;
}
@@ -1237,7 +1274,8 @@ public class FhirContext {
return ourStaticContexts.computeIfAbsent(theFhirVersionEnum, v -> new FhirContext(v));
}
- private static Collection> toCollection(Class extends IBaseResource> theResourceType) {
+ private static Collection> toCollection(
+ Class extends IBaseResource> theResourceType) {
ArrayList> retVal = new ArrayList<>(1);
retVal.add(theResourceType);
return retVal;
@@ -1248,11 +1286,11 @@ public class FhirContext {
ArrayList> retVal = new ArrayList>(1);
for (Class> clazz : theResourceTypes) {
if (!IResource.class.isAssignableFrom(clazz)) {
- throw new IllegalArgumentException(Msg.code(1688) + clazz.getCanonicalName() + " is not an instance of " + IResource.class.getSimpleName());
+ throw new IllegalArgumentException(Msg.code(1688) + clazz.getCanonicalName() + " is not an instance of "
+ + IResource.class.getSimpleName());
}
retVal.add((Class extends IResource>) clazz);
}
return retVal;
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirVersionEnum.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirVersionEnum.java
index 15beeb61185..399fe3163f6 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirVersionEnum.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirVersionEnum.java
@@ -57,7 +57,11 @@ public enum FhirVersionEnum {
private volatile IFhirVersion myVersionImplementation;
private String myFhirVersionString;
- FhirVersionEnum(String theVersionClass, FhirVersionEnum theEquivalent, boolean theIsRi, IVersionProvider theVersionExtractor) {
+ FhirVersionEnum(
+ String theVersionClass,
+ FhirVersionEnum theEquivalent,
+ boolean theIsRi,
+ IVersionProvider theVersionExtractor) {
myVersionClass = theVersionClass;
myEquivalent = theEquivalent;
myFhirVersionString = theVersionExtractor.provideVersion();
@@ -74,7 +78,8 @@ public enum FhirVersionEnum {
}
if (myVersionImplementation == null) {
try {
- myVersionImplementation = (IFhirVersion) Class.forName(myVersionClass).newInstance();
+ myVersionImplementation =
+ (IFhirVersion) Class.forName(myVersionClass).newInstance();
} catch (Exception e) {
throw new InternalErrorException(Msg.code(1710) + "Failed to instantiate FHIR version " + name(), e);
}
@@ -143,7 +148,6 @@ public enum FhirVersionEnum {
return FhirContext.forCached(this);
}
-
private interface IVersionProvider {
String provideVersion();
}
@@ -168,7 +172,6 @@ public enum FhirVersionEnum {
default:
return determineVersionForType(theFhirType.getSuperclass());
}
-
}
private static class Version implements IVersionProvider {
@@ -184,7 +187,6 @@ public enum FhirVersionEnum {
public String provideVersion() {
return myVersion;
}
-
}
/**
@@ -208,7 +210,6 @@ public enum FhirVersionEnum {
public String provideVersion() {
return myVersion;
}
-
}
private static class R4Version implements IVersionProvider {
@@ -228,7 +229,6 @@ public enum FhirVersionEnum {
public String provideVersion() {
return myVersion;
}
-
}
private static class R4BVersion implements IVersionProvider {
@@ -248,7 +248,6 @@ public enum FhirVersionEnum {
public String provideVersion() {
return myVersion;
}
-
}
private static class R5Version implements IVersionProvider {
@@ -268,7 +267,6 @@ public enum FhirVersionEnum {
public String provideVersion() {
return myVersion;
}
-
}
/**
@@ -312,5 +310,4 @@ public enum FhirVersionEnum {
return null;
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/IRuntimeDatatypeDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/IRuntimeDatatypeDefinition.java
index 2c385c2bab5..c943792ee17 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/IRuntimeDatatypeDefinition.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/IRuntimeDatatypeDefinition.java
@@ -25,11 +25,10 @@ import org.hl7.fhir.instance.model.api.IBaseDatatype;
public interface IRuntimeDatatypeDefinition {
boolean isSpecialization();
-
+
public Class extends IBaseDatatype> getProfileOf();
boolean isProfileOf(Class extends IBaseDatatype> theType);
-
- public Class extends IBase> getImplementingClass();
+ public Class extends IBase> getImplementingClass();
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java
index b424d208bfb..002c34edb7e 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java
@@ -48,7 +48,6 @@ import org.hl7.fhir.instance.model.api.ICompositeType;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
-import javax.annotation.Nonnull;
import java.io.IOException;
import java.io.InputStream;
import java.lang.annotation.Annotation;
@@ -68,6 +67,7 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
+import javax.annotation.Nonnull;
import static org.apache.commons.lang3.StringUtils.isBlank;
@@ -85,8 +85,12 @@ class ModelScanner {
private Set> myVersionTypes;
- ModelScanner(FhirContext theContext, FhirVersionEnum theVersion, Map, BaseRuntimeElementDefinition>> theExistingDefinitions,
- @Nonnull Collection> theResourceTypes) throws ConfigurationException {
+ ModelScanner(
+ FhirContext theContext,
+ FhirVersionEnum theVersion,
+ Map, BaseRuntimeElementDefinition>> theExistingDefinitions,
+ @Nonnull Collection> theResourceTypes)
+ throws ConfigurationException {
myContext = theContext;
myVersion = theVersion;
@@ -118,7 +122,9 @@ class ModelScanner {
return myRuntimeChildUndeclaredExtensionDefinition;
}
- private void init(Map, BaseRuntimeElementDefinition>> theExistingDefinitions, Set> theTypesToScan) {
+ private void init(
+ Map, BaseRuntimeElementDefinition>> theExistingDefinitions,
+ Set> theTypesToScan) {
if (theExistingDefinitions != null) {
myClassToElementDefinitions.putAll(theExistingDefinitions);
}
@@ -140,7 +146,8 @@ class ModelScanner {
myScanAlso.clear();
} while (!typesToScan.isEmpty());
- for (Entry, BaseRuntimeElementDefinition>> nextEntry : myClassToElementDefinitions.entrySet()) {
+ for (Entry, BaseRuntimeElementDefinition>> nextEntry :
+ myClassToElementDefinitions.entrySet()) {
if (theExistingDefinitions != null && theExistingDefinitions.containsKey(nextEntry.getKey())) {
continue;
}
@@ -178,7 +185,9 @@ class ModelScanner {
ResourceDef resourceDefinition = pullAnnotation(theClass, ResourceDef.class);
if (resourceDefinition != null) {
if (!IBaseResource.class.isAssignableFrom(theClass)) {
- throw new ConfigurationException(Msg.code(1714) + "Resource type contains a @" + ResourceDef.class.getSimpleName() + " annotation but does not implement " + IResource.class.getCanonicalName() + ": " + theClass.getCanonicalName());
+ throw new ConfigurationException(Msg.code(1714) + "Resource type contains a @"
+ + ResourceDef.class.getSimpleName() + " annotation but does not implement "
+ + IResource.class.getCanonicalName() + ": " + theClass.getCanonicalName());
}
@SuppressWarnings("unchecked")
Class extends IBaseResource> resClass = (Class extends IBaseResource>) theClass;
@@ -204,10 +213,14 @@ class ModelScanner {
Block blockDefinition = pullAnnotation(theClass, Block.class);
if (blockDefinition != null) {
- if (IResourceBlock.class.isAssignableFrom(theClass) || IBaseBackboneElement.class.isAssignableFrom(theClass) || IBaseDatatypeElement.class.isAssignableFrom(theClass)) {
+ if (IResourceBlock.class.isAssignableFrom(theClass)
+ || IBaseBackboneElement.class.isAssignableFrom(theClass)
+ || IBaseDatatypeElement.class.isAssignableFrom(theClass)) {
scanBlock(theClass);
} else {
- throw new ConfigurationException(Msg.code(1715) + "Type contains a @" + Block.class.getSimpleName() + " annotation but does not implement " + IResourceBlock.class.getCanonicalName() + ": " + theClass.getCanonicalName());
+ throw new ConfigurationException(Msg.code(1715) + "Type contains a @" + Block.class.getSimpleName()
+ + " annotation but does not implement " + IResourceBlock.class.getCanonicalName() + ": "
+ + theClass.getCanonicalName());
}
}
@@ -216,7 +229,8 @@ class ModelScanner {
return;
}
- throw new ConfigurationException(Msg.code(1716) + "Resource class[" + theClass.getName() + "] does not contain any valid HAPI-FHIR annotations");
+ throw new ConfigurationException(Msg.code(1716) + "Resource class[" + theClass.getName()
+ + "] does not contain any valid HAPI-FHIR annotations");
}
}
@@ -228,11 +242,14 @@ class ModelScanner {
// Just in case someone messes up when upgrading from DSTU2
if (myContext.getVersion().getVersion().isEqualOrNewerThan(FhirVersionEnum.DSTU3)) {
if (BaseIdentifiableElement.class.isAssignableFrom(theClass)) {
- throw new ConfigurationException(Msg.code(1717) + "@Block class for version " + myContext.getVersion().getVersion().name() + " should not extend " + BaseIdentifiableElement.class.getSimpleName() + ": " + theClass.getName());
+ throw new ConfigurationException(Msg.code(1717) + "@Block class for version "
+ + myContext.getVersion().getVersion().name() + " should not extend "
+ + BaseIdentifiableElement.class.getSimpleName() + ": " + theClass.getName());
}
}
- RuntimeResourceBlockDefinition blockDef = new RuntimeResourceBlockDefinition(blockName, theClass, isStandardType(theClass), myContext, myClassToElementDefinitions);
+ RuntimeResourceBlockDefinition blockDef = new RuntimeResourceBlockDefinition(
+ blockName, theClass, isStandardType(theClass), myContext, myClassToElementDefinitions);
blockDef.populateScanAlso(myScanAlso);
myClassToElementDefinitions.put(theClass, blockDef);
@@ -243,11 +260,13 @@ class ModelScanner {
RuntimeCompositeDatatypeDefinition elementDef;
if (theClass.equals(ExtensionDt.class)) {
- elementDef = new RuntimeExtensionDtDefinition(theDatatypeDefinition, theClass, true, myContext, myClassToElementDefinitions);
+ elementDef = new RuntimeExtensionDtDefinition(
+ theDatatypeDefinition, theClass, true, myContext, myClassToElementDefinitions);
// } else if (IBaseMetaType.class.isAssignableFrom(theClass)) {
// resourceDef = new RuntimeMetaDefinition(theDatatypeDefinition, theClass, isStandardType(theClass));
} else {
- elementDef = new RuntimeCompositeDatatypeDefinition(theDatatypeDefinition, theClass, isStandardType(theClass), myContext, myClassToElementDefinitions);
+ elementDef = new RuntimeCompositeDatatypeDefinition(
+ theDatatypeDefinition, theClass, isStandardType(theClass), myContext, myClassToElementDefinitions);
}
myClassToElementDefinitions.put(theClass, elementDef);
myNameToElementDefinitions.put(elementDef.getName().toLowerCase(), elementDef);
@@ -260,12 +279,14 @@ class ModelScanner {
elementDef.populateScanAlso(myScanAlso);
}
- private String scanPrimitiveDatatype(Class extends IPrimitiveType>> theClass, DatatypeDef theDatatypeDefinition) {
+ private String scanPrimitiveDatatype(
+ Class extends IPrimitiveType>> theClass, DatatypeDef theDatatypeDefinition) {
ourLog.debug("Scanning resource class: {}", theClass.getName());
String resourceName = theDatatypeDefinition.name();
if (isBlank(resourceName)) {
- throw new ConfigurationException(Msg.code(1718) + "Resource type @" + ResourceDef.class.getSimpleName() + " annotation contains no resource name: " + theClass.getCanonicalName());
+ throw new ConfigurationException(Msg.code(1718) + "Resource type @" + ResourceDef.class.getSimpleName()
+ + " annotation contains no resource name: " + theClass.getCanonicalName());
}
BaseRuntimeElementDefinition> elementDef;
@@ -280,7 +301,8 @@ class ModelScanner {
} else if (IIdType.class.isAssignableFrom(theClass)) {
elementDef = new RuntimeIdDatatypeDefinition(theDatatypeDefinition, theClass, isStandardType(theClass));
} else {
- elementDef = new RuntimePrimitiveDatatypeDefinition(theDatatypeDefinition, theClass, isStandardType(theClass));
+ elementDef =
+ new RuntimePrimitiveDatatypeDefinition(theDatatypeDefinition, theClass, isStandardType(theClass));
}
myClassToElementDefinitions.put(theClass, elementDef);
if (!theDatatypeDefinition.isSpecialization()) {
@@ -312,8 +334,9 @@ class ModelScanner {
parent = parent.getSuperclass();
}
if (isBlank(resourceName)) {
- throw new ConfigurationException(Msg.code(1719) + "Resource type @" + ResourceDef.class.getSimpleName() + " annotation contains no resource name(): " + theClass.getCanonicalName()
- + " - This is only allowed for types that extend other resource types ");
+ throw new ConfigurationException(Msg.code(1719) + "Resource type @" + ResourceDef.class.getSimpleName()
+ + " annotation contains no resource name(): " + theClass.getCanonicalName()
+ + " - This is only allowed for types that extend other resource types ");
}
}
@@ -329,12 +352,17 @@ class ModelScanner {
String resourceId = resourceDefinition.id();
if (!isBlank(resourceId)) {
if (myIdToResourceDefinition.containsKey(resourceId)) {
- throw new ConfigurationException(Msg.code(1720) + "The following resource types have the same ID of '" + resourceId + "' - " + theClass.getCanonicalName() + " and "
- + myIdToResourceDefinition.get(resourceId).getImplementingClass().getCanonicalName());
+ throw new ConfigurationException(Msg.code(1720) + "The following resource types have the same ID of '"
+ + resourceId + "' - " + theClass.getCanonicalName() + " and "
+ + myIdToResourceDefinition
+ .get(resourceId)
+ .getImplementingClass()
+ .getCanonicalName());
}
}
- RuntimeResourceDefinition resourceDef = new RuntimeResourceDefinition(myContext, resourceName, theClass, resourceDefinition, standardType, myClassToElementDefinitions);
+ RuntimeResourceDefinition resourceDef = new RuntimeResourceDefinition(
+ myContext, resourceName, theClass, resourceDefinition, standardType, myClassToElementDefinitions);
myClassToElementDefinitions.put(theClass, resourceDef);
if (primaryNameProvider) {
if (resourceDef.getStructureVersion() == myVersion) {
@@ -360,7 +388,8 @@ class ModelScanner {
return resourceName;
}
- private void scanResourceForSearchParams(Class extends IBaseResource> theClass, RuntimeResourceDefinition theResourceDef) {
+ private void scanResourceForSearchParams(
+ Class extends IBaseResource> theClass, RuntimeResourceDefinition theResourceDef) {
Map nameToParam = new HashMap<>();
Map compositeFields = new LinkedHashMap<>();
@@ -384,9 +413,11 @@ class ModelScanner {
for (Field nextField : fields) {
SearchParamDefinition searchParam = pullAnnotation(nextField, SearchParamDefinition.class);
if (searchParam != null) {
- RestSearchParameterTypeEnum paramType = RestSearchParameterTypeEnum.forCode(searchParam.type().toLowerCase());
+ RestSearchParameterTypeEnum paramType =
+ RestSearchParameterTypeEnum.forCode(searchParam.type().toLowerCase());
if (paramType == null) {
- throw new ConfigurationException(Msg.code(1721) + "Search param " + searchParam.name() + " has an invalid type: " + searchParam.type());
+ throw new ConfigurationException(Msg.code(1721) + "Search param " + searchParam.name()
+ + " has an invalid type: " + searchParam.type());
}
Set providesMembershipInCompartments;
providesMembershipInCompartments = new HashSet<>();
@@ -425,12 +456,23 @@ class ModelScanner {
String name = searchParam.name();
url = toCanonicalSearchParameterUri(theResourceDef, name);
}
- RuntimeSearchParam param = new RuntimeSearchParam(null, url, searchParam.name(), searchParam.description(), searchParam.path(), paramType, providesMembershipInCompartments, toTargetList(searchParam.target()), RuntimeSearchParamStatusEnum.ACTIVE, null, components, base);
+ RuntimeSearchParam param = new RuntimeSearchParam(
+ null,
+ url,
+ searchParam.name(),
+ searchParam.description(),
+ searchParam.path(),
+ paramType,
+ providesMembershipInCompartments,
+ toTargetList(searchParam.target()),
+ RuntimeSearchParamStatusEnum.ACTIVE,
+ null,
+ components,
+ base);
theResourceDef.addSearchParam(param);
nameToParam.put(param.getName(), param);
}
}
-
}
private String toCanonicalSearchParameterUri(RuntimeResourceDefinition theResourceDef, String theName) {
@@ -455,7 +497,9 @@ class ModelScanner {
if (List.class.equals(nextElementType)) {
nextElementType = ReflectionUtil.getGenericCollectionTypeOfField(next);
} else if (Collection.class.isAssignableFrom(nextElementType)) {
- throw new ConfigurationException(Msg.code(1722) + "Field '" + next.getName() + "' in type '" + next.getClass().getCanonicalName() + "' is a Collection - Only java.util.List curently supported");
+ throw new ConfigurationException(Msg.code(1722) + "Field '" + next.getName() + "' in type '"
+ + next.getClass().getCanonicalName()
+ + "' is a Collection - Only java.util.List curently supported");
}
return nextElementType;
}
@@ -464,7 +508,8 @@ class ModelScanner {
static IValueSetEnumBinder> getBoundCodeBinder(Field theNext) {
Class> bound = getGenericCollectionTypeOfCodedField(theNext);
if (bound == null) {
- throw new ConfigurationException(Msg.code(1723) + "Field '" + theNext + "' has no parameter for " + BoundCodeDt.class.getSimpleName() + " to determine enum type");
+ throw new ConfigurationException(Msg.code(1723) + "Field '" + theNext + "' has no parameter for "
+ + BoundCodeDt.class.getSimpleName() + " to determine enum type");
}
String fieldName = "VALUESET_BINDER";
@@ -472,7 +517,11 @@ class ModelScanner {
Field bindingField = bound.getField(fieldName);
return (IValueSetEnumBinder>) bindingField.get(null);
} catch (Exception e) {
- throw new ConfigurationException(Msg.code(1724) + "Field '" + theNext + "' has type parameter " + bound.getCanonicalName() + " but this class has no valueset binding field (must have a field called " + fieldName + ")", e);
+ throw new ConfigurationException(
+ Msg.code(1724) + "Field '" + theNext + "' has type parameter " + bound.getCanonicalName()
+ + " but this class has no valueset binding field (must have a field called " + fieldName
+ + ")",
+ e);
}
}
@@ -488,7 +537,8 @@ class ModelScanner {
static Class extends Enum>> determineEnumTypeForBoundField(Field next) {
@SuppressWarnings("unchecked")
- Class extends Enum>> enumType = (Class extends Enum>>) ReflectionUtil.getGenericCollectionTypeOfFieldWithSecondOrderForList(next);
+ Class extends Enum>> enumType =
+ (Class extends Enum>>) ReflectionUtil.getGenericCollectionTypeOfFieldWithSecondOrderForList(next);
return enumType;
}
@@ -506,7 +556,11 @@ class ModelScanner {
return type;
}
- static Set> scanVersionPropertyFile(Set> theDatatypes, Map> theResourceTypes, FhirVersionEnum theVersion, Map, BaseRuntimeElementDefinition>> theExistingElementDefinitions) {
+ static Set> scanVersionPropertyFile(
+ Set> theDatatypes,
+ Map> theResourceTypes,
+ FhirVersionEnum theVersion,
+ Map, BaseRuntimeElementDefinition>> theExistingElementDefinitions) {
Set> retVal = new HashSet<>();
try (InputStream str = theVersion.getVersionImplementation().getFhirVersionPropertiesFile()) {
@@ -537,12 +591,16 @@ class ModelScanner {
Class extends IBaseDatatype> nextClass = (Class extends IBaseDatatype>) dtType;
theDatatypes.add(nextClass);
} else {
- ourLog.warn("Class is not assignable from " + IElement.class.getSimpleName() + " or " + IBaseDatatype.class.getSimpleName() + ": " + nextValue);
+ ourLog.warn("Class is not assignable from " + IElement.class.getSimpleName() + " or "
+ + IBaseDatatype.class.getSimpleName() + ": " + nextValue);
continue;
}
} catch (ClassNotFoundException e) {
- throw new ConfigurationException(Msg.code(1725) + "Unknown class[" + nextValue + "] for data type definition: " + nextKey.substring("datatype.".length()), e);
+ throw new ConfigurationException(
+ Msg.code(1725) + "Unknown class[" + nextValue + "] for data type definition: "
+ + nextKey.substring("datatype.".length()),
+ e);
}
}
} else if (nextKey.startsWith("resource.")) {
@@ -550,27 +608,33 @@ class ModelScanner {
String resName = nextKey.substring("resource.".length()).toLowerCase();
try {
@SuppressWarnings("unchecked")
- Class extends IBaseResource> nextClass = (Class extends IBaseResource>) Class.forName(nextValue);
+ Class extends IBaseResource> nextClass =
+ (Class extends IBaseResource>) Class.forName(nextValue);
if (theExistingElementDefinitions.containsKey(nextClass)) {
continue;
}
if (!IBaseResource.class.isAssignableFrom(nextClass)) {
- throw new ConfigurationException(Msg.code(1726) + "Class is not assignable from " + IBaseResource.class.getSimpleName() + ": " + nextValue);
+ throw new ConfigurationException(Msg.code(1726) + "Class is not assignable from "
+ + IBaseResource.class.getSimpleName() + ": " + nextValue);
}
theResourceTypes.put(resName, nextClass);
} catch (ClassNotFoundException e) {
- throw new ConfigurationException(Msg.code(1727) + "Unknown class[" + nextValue + "] for resource definition: " + nextKey.substring("resource.".length()), e);
+ throw new ConfigurationException(
+ Msg.code(1727) + "Unknown class[" + nextValue + "] for resource definition: "
+ + nextKey.substring("resource.".length()),
+ e);
}
} else {
- throw new ConfigurationException(Msg.code(1728) + "Unexpected property in version property file: " + nextKey + "=" + nextValue);
+ throw new ConfigurationException(Msg.code(1728) + "Unexpected property in version property file: "
+ + nextKey + "=" + nextValue);
}
}
} catch (IOException e) {
- throw new ConfigurationException(Msg.code(1729) + "Failed to load model property file from classpath: " + "/ca/uhn/fhir/model/dstu/model.properties");
+ throw new ConfigurationException(Msg.code(1729) + "Failed to load model property file from classpath: "
+ + "/ca/uhn/fhir/model/dstu/model.properties");
}
return retVal;
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ParserOptions.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ParserOptions.java
index 351e02d00e4..065a5d6523d 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ParserOptions.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ParserOptions.java
@@ -200,9 +200,9 @@ public class ParserOptions {
* Bundle.entry.fullUrl
* @return Returns a reference to this parser so that method calls can be chained together
*/
- public ParserOptions setOverrideResourceIdWithBundleEntryFullUrl(boolean theOverrideResourceIdWithBundleEntryFullUrl) {
+ public ParserOptions setOverrideResourceIdWithBundleEntryFullUrl(
+ boolean theOverrideResourceIdWithBundleEntryFullUrl) {
myOverrideResourceIdWithBundleEntryFullUrl = theOverrideResourceIdWithBundleEntryFullUrl;
return this;
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/PerformanceOptionsEnum.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/PerformanceOptionsEnum.java
index 856d554dafb..5721bfd9dc8 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/PerformanceOptionsEnum.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/PerformanceOptionsEnum.java
@@ -25,15 +25,14 @@ package ca.uhn.fhir.context;
public enum PerformanceOptionsEnum {
/**
- * When this option is set, model classes will not be scanned for children until the
+ * When this option is set, model classes will not be scanned for children until the
* child list for the given type is actually accessed.
*
* The effect of this option is that reflection operations to scan children will be
* deferred, and some may never happen if specific model types aren't actually used.
* This option is useful on environments where reflection is particularly slow, e.g.
* Android or low powered devices.
- *
+ *
*/
DEFERRED_MODEL_SCANNING
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildAny.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildAny.java
index 241076babe8..9119d86331c 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildAny.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildAny.java
@@ -19,6 +19,15 @@
*/
package ca.uhn.fhir.context;
+import ca.uhn.fhir.model.api.IDatatype;
+import ca.uhn.fhir.model.api.IResource;
+import ca.uhn.fhir.model.api.annotation.Child;
+import ca.uhn.fhir.model.api.annotation.Description;
+import ca.uhn.fhir.model.primitive.XhtmlDt;
+import org.hl7.fhir.instance.model.api.IBase;
+import org.hl7.fhir.instance.model.api.IBaseDatatype;
+import org.hl7.fhir.instance.model.api.IBaseReference;
+
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collections;
@@ -26,47 +35,43 @@ import java.util.Comparator;
import java.util.List;
import java.util.Map;
-import org.hl7.fhir.instance.model.api.IBase;
-import org.hl7.fhir.instance.model.api.IBaseDatatype;
-import org.hl7.fhir.instance.model.api.IBaseReference;
-
-import ca.uhn.fhir.model.api.IDatatype;
-import ca.uhn.fhir.model.api.IResource;
-import ca.uhn.fhir.model.api.annotation.Child;
-import ca.uhn.fhir.model.api.annotation.Description;
-import ca.uhn.fhir.model.primitive.XhtmlDt;
-
public class RuntimeChildAny extends RuntimeChildChoiceDefinition {
- public RuntimeChildAny(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation) {
+ public RuntimeChildAny(
+ Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation) {
super(theField, theElementName, theChildAnnotation, theDescriptionAnnotation);
}
@Override
- void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
+ void sealAndInitialize(
+ FhirContext theContext,
+ Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
List> choiceTypes = new ArrayList>();
-
+
for (Class extends IBase> next : theClassToElementDefinitions.keySet()) {
if (next.equals(XhtmlDt.class)) {
continue;
}
-
+
BaseRuntimeElementDefinition> nextDef = theClassToElementDefinitions.get(next);
if (nextDef instanceof IRuntimeDatatypeDefinition) {
if (((IRuntimeDatatypeDefinition) nextDef).isSpecialization()) {
/*
- * Things like BoundCodeDt shoudn't be considered as valid options for an "any" choice, since
- * we'll already have CodeDt as an option
+ * Things like BoundCodeDt shoudn't be considered as valid options for an "any" choice, since
+ * we'll already have CodeDt as an option
*/
continue;
}
}
-
- if (IResource.class.isAssignableFrom(next) || IDatatype.class.isAssignableFrom(next) || IBaseDatatype.class.isAssignableFrom(next) || IBaseReference.class.isAssignableFrom(next)) {
+
+ if (IResource.class.isAssignableFrom(next)
+ || IDatatype.class.isAssignableFrom(next)
+ || IBaseDatatype.class.isAssignableFrom(next)
+ || IBaseReference.class.isAssignableFrom(next)) {
choiceTypes.add(next);
}
}
- Collections.sort(choiceTypes,new Comparator>(){
+ Collections.sort(choiceTypes, new Comparator>() {
@Override
public int compare(Class> theO1, Class> theO2) {
boolean o1res = IResource.class.isAssignableFrom(theO1);
@@ -77,16 +82,14 @@ public class RuntimeChildAny extends RuntimeChildChoiceDefinition {
return -1;
} else if (o1res == false && o2res == false) {
return 0;
- }else {
+ } else {
return 1;
}
- }});
-
+ }
+ });
+
setChoiceTypes(choiceTypes);
-
+
super.sealAndInitialize(theContext, theClassToElementDefinitions);
}
-
-
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildChoiceDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildChoiceDefinition.java
index 2a6f357805a..cc0a21c49c7 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildChoiceDefinition.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildChoiceDefinition.java
@@ -49,7 +49,12 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
/**
* Constructor
*/
- public RuntimeChildChoiceDefinition(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation, List> theChoiceTypes) {
+ public RuntimeChildChoiceDefinition(
+ Field theField,
+ String theElementName,
+ Child theChildAnnotation,
+ Description theDescriptionAnnotation,
+ List> theChoiceTypes) {
super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName);
myChoiceTypes = Collections.unmodifiableList(theChoiceTypes);
@@ -57,10 +62,11 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
/**
* Constructor
- *
+ *
* For extension, if myChoiceTypes will be set some other way
*/
- RuntimeChildChoiceDefinition(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation) {
+ RuntimeChildChoiceDefinition(
+ Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation) {
super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName);
}
@@ -79,14 +85,17 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
@Override
public BaseRuntimeElementDefinition> getChildByName(String theName) {
- assert myNameToChildDefinition.containsKey(theName) : "Can't find child '" + theName + "' in names: " + myNameToChildDefinition.keySet();
+ assert myNameToChildDefinition.containsKey(theName)
+ : "Can't find child '" + theName + "' in names: " + myNameToChildDefinition.keySet();
return myNameToChildDefinition.get(theName);
}
@SuppressWarnings("unchecked")
@Override
- void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
+ void sealAndInitialize(
+ FhirContext theContext,
+ Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
myNameToChildDefinition = new HashMap>();
myDatatypeToElementName = new HashMap, String>();
myDatatypeToElementDefinition = new HashMap, BaseRuntimeElementDefinition>>();
@@ -105,7 +114,7 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
myNameToChildDefinition.put(getElementName() + "Reference", nextDef);
myNameToChildDefinition.put(getElementName() + "Resource", nextDef);
-
+
myResourceTypes.add((Class extends IBaseResource>) next);
} else {
@@ -118,7 +127,7 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
* unprofiled datatype as the element name. E.g. if foo[x] allows markdown as a datatype, it calls the
* element fooString when encoded, because markdown is a profile of string. This is according to the
* FHIR spec
- *
+ *
* Note that as of HAPI 1.4 this applies only to non-primitive datatypes after discussion
* with Grahame.
*/
@@ -158,7 +167,9 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
if (myDatatypeToElementName.containsKey(next)) {
String existing = myDatatypeToElementName.get(next);
if (!existing.equals(elementName)) {
- throw new ConfigurationException(Msg.code(1693) + "Already have element name " + existing + " for datatype " + next.getSimpleName() + " in " + getElementName() + ", cannot add " + elementName);
+ throw new ConfigurationException(
+ Msg.code(1693) + "Already have element name " + existing + " for datatype "
+ + next.getSimpleName() + " in " + getElementName() + ", cannot add " + elementName);
}
} else {
myDatatypeToElementName.put(next, elementName);
@@ -171,7 +182,6 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
myResourceTypes = Collections.unmodifiableList(myResourceTypes);
}
-
public List> getResourceTypes() {
return myResourceTypes;
}
@@ -190,5 +200,4 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
public Set> getValidChildTypes() {
return Collections.unmodifiableSet((myDatatypeToElementDefinition.keySet()));
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildCompositeBoundDatatypeDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildCompositeBoundDatatypeDefinition.java
index 3dc29e327ab..00eaa70ad1b 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildCompositeBoundDatatypeDefinition.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildCompositeBoundDatatypeDefinition.java
@@ -19,25 +19,31 @@
*/
package ca.uhn.fhir.context;
-import java.lang.reflect.Field;
-
-import org.apache.commons.lang3.Validate;
-import org.hl7.fhir.instance.model.api.IBase;
-
import ca.uhn.fhir.model.api.IValueSetEnumBinder;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
+import org.apache.commons.lang3.Validate;
+import org.hl7.fhir.instance.model.api.IBase;
+
+import java.lang.reflect.Field;
public class RuntimeChildCompositeBoundDatatypeDefinition extends RuntimeChildCompositeDatatypeDefinition {
private IValueSetEnumBinder> myBinder;
private Class extends Enum>> myEnumType;
- public RuntimeChildCompositeBoundDatatypeDefinition(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation, Class extends IBase> theDatatype, IValueSetEnumBinder> theBinder, Class extends Enum>> theEnumType) {
+ public RuntimeChildCompositeBoundDatatypeDefinition(
+ Field theField,
+ String theElementName,
+ Child theChildAnnotation,
+ Description theDescriptionAnnotation,
+ Class extends IBase> theDatatype,
+ IValueSetEnumBinder> theBinder,
+ Class extends Enum>> theEnumType) {
super(theField, theElementName, theChildAnnotation, theDescriptionAnnotation, theDatatype);
Validate.notNull(theBinder, "theBinder must not be null");
Validate.notNull(theEnumType, "theEnumType must not be null");
-
+
myBinder = theBinder;
myEnumType = theEnumType;
}
@@ -51,5 +57,4 @@ public class RuntimeChildCompositeBoundDatatypeDefinition extends RuntimeChildCo
public Class extends Enum>> getBoundEnumType() {
return myEnumType;
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildCompositeDatatypeDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildCompositeDatatypeDefinition.java
index 55666d5de3b..75eb6bc3f39 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildCompositeDatatypeDefinition.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildCompositeDatatypeDefinition.java
@@ -19,18 +19,20 @@
*/
package ca.uhn.fhir.context;
-import java.lang.reflect.Field;
-
-import org.hl7.fhir.instance.model.api.IBase;
-
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
+import org.hl7.fhir.instance.model.api.IBase;
+
+import java.lang.reflect.Field;
public class RuntimeChildCompositeDatatypeDefinition extends BaseRuntimeChildDatatypeDefinition {
- public RuntimeChildCompositeDatatypeDefinition(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation, Class extends IBase> theDatatype) {
- super(theField, theElementName, theChildAnnotation,theDescriptionAnnotation, theDatatype);
+ public RuntimeChildCompositeDatatypeDefinition(
+ Field theField,
+ String theElementName,
+ Child theChildAnnotation,
+ Description theDescriptionAnnotation,
+ Class extends IBase> theDatatype) {
+ super(theField, theElementName, theChildAnnotation, theDescriptionAnnotation, theDatatype);
}
-
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildContainedResources.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildContainedResources.java
index 3c9821fdf02..d8c635f61ab 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildContainedResources.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildContainedResources.java
@@ -36,7 +36,9 @@ public class RuntimeChildContainedResources extends BaseRuntimeDeclaredChildDefi
private BaseRuntimeElementDefinition> myElem;
- RuntimeChildContainedResources(Field theField, Child theChildAnnotation, Description theDescriptionAnnotation, String theElementName) throws ConfigurationException {
+ RuntimeChildContainedResources(
+ Field theField, Child theChildAnnotation, Description theDescriptionAnnotation, String theElementName)
+ throws ConfigurationException {
super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName);
}
@@ -72,7 +74,9 @@ public class RuntimeChildContainedResources extends BaseRuntimeDeclaredChildDefi
}
@Override
- void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
+ void sealAndInitialize(
+ FhirContext theContext,
+ Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
Class> actualType = theContext.getVersion().getContainedType();
if (BaseContainedDt.class.isAssignableFrom(actualType)) {
@SuppressWarnings("unchecked")
@@ -81,8 +85,8 @@ public class RuntimeChildContainedResources extends BaseRuntimeDeclaredChildDefi
} else if (List.class.isAssignableFrom(actualType)) {
myElem = new RuntimeElemContainedResourceList(IBaseResource.class, false);
} else {
- throw new ConfigurationException(Msg.code(1735) + "Fhir Version definition returned invalid contained type: " + actualType);
+ throw new ConfigurationException(
+ Msg.code(1735) + "Fhir Version definition returned invalid contained type: " + actualType);
}
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildDeclaredExtensionDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildDeclaredExtensionDefinition.java
index 81f81a83cad..4e54d193921 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildDeclaredExtensionDefinition.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildDeclaredExtensionDefinition.java
@@ -19,7 +19,12 @@
*/
package ca.uhn.fhir.context;
-import static org.apache.commons.lang3.StringUtils.isNotBlank;
+import ca.uhn.fhir.model.api.IElement;
+import ca.uhn.fhir.model.api.annotation.Child;
+import ca.uhn.fhir.model.api.annotation.Description;
+import ca.uhn.fhir.model.api.annotation.Extension;
+import ca.uhn.fhir.util.ReflectionUtil;
+import org.hl7.fhir.instance.model.api.IBase;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
@@ -29,13 +34,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.hl7.fhir.instance.model.api.IBase;
-
-import ca.uhn.fhir.model.api.IElement;
-import ca.uhn.fhir.model.api.annotation.Child;
-import ca.uhn.fhir.model.api.annotation.Description;
-import ca.uhn.fhir.model.api.annotation.Extension;
-import ca.uhn.fhir.util.ReflectionUtil;
+import static org.apache.commons.lang3.StringUtils.isNotBlank;
public class RuntimeChildDeclaredExtensionDefinition extends RuntimeChildChoiceDefinition {
@@ -56,8 +55,15 @@ public class RuntimeChildDeclaredExtensionDefinition extends RuntimeChildChoiceD
* @param theDefinedLocally
* See {@link Extension#definedLocally()}
*/
- RuntimeChildDeclaredExtensionDefinition(Field theField, Child theChild, Description theDescriptionAnnotation, Extension theExtension, String theElementName, String theExtensionUrl,
- Class extends IBase> theChildType, Object theBoundTypeBinder)
+ RuntimeChildDeclaredExtensionDefinition(
+ Field theField,
+ Child theChild,
+ Description theDescriptionAnnotation,
+ Extension theExtension,
+ String theElementName,
+ String theExtensionUrl,
+ Class extends IBase> theChildType,
+ Object theBoundTypeBinder)
throws ConfigurationException {
super(theField, theElementName, theChild, theDescriptionAnnotation);
assert isNotBlank(theExtensionUrl);
@@ -116,7 +122,6 @@ public class RuntimeChildDeclaredExtensionDefinition extends RuntimeChildChoiceD
return "modifierExtension";
}
return "extension";
-
}
return retVal;
}
@@ -124,7 +129,7 @@ public class RuntimeChildDeclaredExtensionDefinition extends RuntimeChildChoiceD
@Override
public BaseRuntimeElementDefinition> getChildByName(String theName) {
String name = theName;
- if ("extension".equals(name)||"modifierExtension".equals(name)) {
+ if ("extension".equals(name) || "modifierExtension".equals(name)) {
if (myChildResourceBlock != null) {
return myChildResourceBlock;
}
@@ -136,7 +141,7 @@ public class RuntimeChildDeclaredExtensionDefinition extends RuntimeChildChoiceD
if (getValidChildNames().contains(name) == false) {
return null;
}
-
+
return super.getChildByName(name);
}
@@ -169,7 +174,9 @@ public class RuntimeChildDeclaredExtensionDefinition extends RuntimeChildChoiceD
}
@Override
- void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
+ void sealAndInitialize(
+ FhirContext theContext,
+ Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
myUrlToChildExtension = new HashMap();
BaseRuntimeElementDefinition> elementDef = theClassToElementDefinitions.get(myChildType);
@@ -184,17 +191,19 @@ public class RuntimeChildDeclaredExtensionDefinition extends RuntimeChildChoiceD
}
}
- if (elementDef instanceof RuntimePrimitiveDatatypeDefinition || elementDef instanceof RuntimeCompositeDatatypeDefinition) {
-// myDatatypeChildName = "value" + elementDef.getName().substring(0, 1).toUpperCase() + elementDef.getName().substring(1);
-// if ("valueResourceReference".equals(myDatatypeChildName)) {
- // Per one of the examples here: http://hl7.org/implement/standards/fhir/extensibility.html#extension
-// myDatatypeChildName = "valueResource";
-// List> types = new ArrayList>();
-// types.add(IBaseResource.class);
-// myChildDef = findResourceReferenceDefinition(theClassToElementDefinitions);
-// } else {
- myChildDef = elementDef;
-// }
+ if (elementDef instanceof RuntimePrimitiveDatatypeDefinition
+ || elementDef instanceof RuntimeCompositeDatatypeDefinition) {
+ // myDatatypeChildName = "value" + elementDef.getName().substring(0, 1).toUpperCase() +
+ // elementDef.getName().substring(1);
+ // if ("valueResourceReference".equals(myDatatypeChildName)) {
+ // Per one of the examples here: http://hl7.org/implement/standards/fhir/extensibility.html#extension
+ // myDatatypeChildName = "valueResource";
+ // List> types = new ArrayList>();
+ // types.add(IBaseResource.class);
+ // myChildDef = findResourceReferenceDefinition(theClassToElementDefinitions);
+ // } else {
+ myChildDef = elementDef;
+ // }
} else if (elementDef instanceof RuntimeResourceBlockDefinition) {
RuntimeResourceBlockDefinition extDef = ((RuntimeResourceBlockDefinition) elementDef);
for (RuntimeChildDeclaredExtensionDefinition next : extDef.getExtensions()) {
@@ -215,5 +224,4 @@ public class RuntimeChildDeclaredExtensionDefinition extends RuntimeChildChoiceD
public Class extends IBase> getChildType() {
return myChildType;
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildDirectResource.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildDirectResource.java
index c7aa3e384b7..8454fbad54c 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildDirectResource.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildDirectResource.java
@@ -19,23 +19,24 @@
*/
package ca.uhn.fhir.context;
+import ca.uhn.fhir.model.api.annotation.Child;
+import ca.uhn.fhir.model.api.annotation.Description;
+import org.hl7.fhir.instance.model.api.IBase;
+import org.hl7.fhir.instance.model.api.IBaseResource;
+
import java.lang.reflect.Field;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
-import org.hl7.fhir.instance.model.api.IBase;
-import org.hl7.fhir.instance.model.api.IBaseResource;
-
-import ca.uhn.fhir.model.api.annotation.Child;
-import ca.uhn.fhir.model.api.annotation.Description;
-
public class RuntimeChildDirectResource extends BaseRuntimeDeclaredChildDefinition {
-// private RuntimeElemContainedResources myElem;
+ // private RuntimeElemContainedResources myElem;
private FhirContext myContext;
- RuntimeChildDirectResource(Field theField, Child theChildAnnotation, Description theDescriptionAnnotation, String theElementName) throws ConfigurationException {
+ RuntimeChildDirectResource(
+ Field theField, Child theChildAnnotation, Description theDescriptionAnnotation, String theElementName)
+ throws ConfigurationException {
super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName);
}
@@ -61,8 +62,9 @@ public class RuntimeChildDirectResource extends BaseRuntimeDeclaredChildDefiniti
}
@Override
- void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
+ void sealAndInitialize(
+ FhirContext theContext,
+ Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
myContext = theContext;
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildExt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildExt.java
index 3a38c6e2930..c6af9951a0c 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildExt.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildExt.java
@@ -112,7 +112,9 @@ public class RuntimeChildExt extends BaseRuntimeChildDefinition {
}
@Override
- void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
+ void sealAndInitialize(
+ FhirContext theContext,
+ Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
myNameToChild = new HashMap<>();
myDatatypeToChild = new HashMap<>();
myDatatypeToChildName = new HashMap<>();
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildExtension.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildExtension.java
index 902a0ed35d3..1bf1de8d56d 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildExtension.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildExtension.java
@@ -19,20 +19,20 @@
*/
package ca.uhn.fhir.context;
+import ca.uhn.fhir.model.api.annotation.Child;
+import ca.uhn.fhir.model.api.annotation.Description;
+import org.hl7.fhir.instance.model.api.IBase;
+
import java.lang.reflect.Field;
import java.util.Collections;
import java.util.Set;
-import org.hl7.fhir.instance.model.api.IBase;
-
-import ca.uhn.fhir.model.api.annotation.Child;
-import ca.uhn.fhir.model.api.annotation.Description;
-
public class RuntimeChildExtension extends RuntimeChildAny {
-// private RuntimeChildUndeclaredExtensionDefinition myExtensionElement;
+ // private RuntimeChildUndeclaredExtensionDefinition myExtensionElement;
- public RuntimeChildExtension(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation) {
+ public RuntimeChildExtension(
+ Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation) {
super(theField, theElementName, theChildAnnotation, theDescriptionAnnotation);
}
@@ -53,21 +53,21 @@ public class RuntimeChildExtension extends RuntimeChildAny {
}
return super.getChildByName(theName);
}
-
-// @Override
-// public BaseRuntimeElementDefinition> getChildElementDefinitionByDatatype(Class extends IBase> theDatatype) {
-// if (IBaseExtension.class.isAssignableFrom(theDatatype)) {
-// return myExtensionElement;
-// }
-// return super.getChildElementDefinitionByDatatype(theDatatype);
-// }
-//
-// @Override
-// void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
-// super.sealAndInitialize(theContext, theClassToElementDefinitions);
-//
-// myExtensionElement = theContext.getRuntimeChildUndeclaredExtensionDefinition();
-// }
+ // @Override
+ // public BaseRuntimeElementDefinition> getChildElementDefinitionByDatatype(Class extends IBase> theDatatype) {
+ // if (IBaseExtension.class.isAssignableFrom(theDatatype)) {
+ // return myExtensionElement;
+ // }
+ // return super.getChildElementDefinitionByDatatype(theDatatype);
+ // }
+ //
+ // @Override
+ // void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition>>
+ // theClassToElementDefinitions) {
+ // super.sealAndInitialize(theContext, theClassToElementDefinitions);
+ //
+ // myExtensionElement = theContext.getRuntimeChildUndeclaredExtensionDefinition();
+ // }
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildNarrativeDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildNarrativeDefinition.java
index a0889b5cfe4..b9e8162d1b5 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildNarrativeDefinition.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildNarrativeDefinition.java
@@ -19,18 +19,20 @@
*/
package ca.uhn.fhir.context;
-import java.lang.reflect.Field;
-
-import org.hl7.fhir.instance.model.api.IBase;
-
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
+import org.hl7.fhir.instance.model.api.IBase;
+
+import java.lang.reflect.Field;
public class RuntimeChildNarrativeDefinition extends RuntimeChildCompositeDatatypeDefinition {
- public RuntimeChildNarrativeDefinition(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation, Class extends IBase> theDatatype) {
- super(theField, theElementName, theChildAnnotation,theDescriptionAnnotation, theDatatype);
+ public RuntimeChildNarrativeDefinition(
+ Field theField,
+ String theElementName,
+ Child theChildAnnotation,
+ Description theDescriptionAnnotation,
+ Class extends IBase> theDatatype) {
+ super(theField, theElementName, theChildAnnotation, theDescriptionAnnotation, theDatatype);
}
-
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildPrimitiveBoundCodeDatatypeDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildPrimitiveBoundCodeDatatypeDefinition.java
index b56696c2dfb..ecbfb1d6bd3 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildPrimitiveBoundCodeDatatypeDefinition.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildPrimitiveBoundCodeDatatypeDefinition.java
@@ -19,19 +19,25 @@
*/
package ca.uhn.fhir.context;
-import java.lang.reflect.Field;
-
-import org.hl7.fhir.instance.model.api.IBase;
-
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
+import org.hl7.fhir.instance.model.api.IBase;
+
+import java.lang.reflect.Field;
public class RuntimeChildPrimitiveBoundCodeDatatypeDefinition extends RuntimeChildPrimitiveDatatypeDefinition {
private Object myBinder;
private Class extends Enum>> myEnumType;
- public RuntimeChildPrimitiveBoundCodeDatatypeDefinition(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation, Class extends IBase> theDatatype, Object theBinder, Class extends Enum>> theEnumType) {
+ public RuntimeChildPrimitiveBoundCodeDatatypeDefinition(
+ Field theField,
+ String theElementName,
+ Child theChildAnnotation,
+ Description theDescriptionAnnotation,
+ Class extends IBase> theDatatype,
+ Object theBinder,
+ Class extends Enum>> theEnumType) {
super(theField, theElementName, theDescriptionAnnotation, theChildAnnotation, theDatatype);
myBinder = theBinder;
@@ -47,5 +53,4 @@ public class RuntimeChildPrimitiveBoundCodeDatatypeDefinition extends RuntimeChi
public Object getInstanceConstructorArguments() {
return myBinder;
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildPrimitiveDatatypeDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildPrimitiveDatatypeDefinition.java
index df760077a49..b913d51ed1e 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildPrimitiveDatatypeDefinition.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildPrimitiveDatatypeDefinition.java
@@ -19,17 +19,20 @@
*/
package ca.uhn.fhir.context;
-import java.lang.reflect.Field;
-
-import org.hl7.fhir.instance.model.api.IBase;
-
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
+import org.hl7.fhir.instance.model.api.IBase;
+
+import java.lang.reflect.Field;
public class RuntimeChildPrimitiveDatatypeDefinition extends BaseRuntimeChildDatatypeDefinition {
- public RuntimeChildPrimitiveDatatypeDefinition(Field theField, String theElementName, Description theDescriptionAnnotation, Child theChildAnnotation, Class extends IBase> theDatatype) {
+ public RuntimeChildPrimitiveDatatypeDefinition(
+ Field theField,
+ String theElementName,
+ Description theDescriptionAnnotation,
+ Child theChildAnnotation,
+ Class extends IBase> theDatatype) {
super(theField, theElementName, theChildAnnotation, theDescriptionAnnotation, theDatatype);
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildPrimitiveEnumerationDatatypeDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildPrimitiveEnumerationDatatypeDefinition.java
index 16c665cf585..4734bf812a6 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildPrimitiveEnumerationDatatypeDefinition.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildPrimitiveEnumerationDatatypeDefinition.java
@@ -31,7 +31,13 @@ public class RuntimeChildPrimitiveEnumerationDatatypeDefinition extends RuntimeC
private Object myBinder;
private Class extends Enum>> myEnumType;
- public RuntimeChildPrimitiveEnumerationDatatypeDefinition(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation, Class extends IBase> theDatatype, Class extends Enum>> theBinderType) {
+ public RuntimeChildPrimitiveEnumerationDatatypeDefinition(
+ Field theField,
+ String theElementName,
+ Child theChildAnnotation,
+ Description theDescriptionAnnotation,
+ Class extends IBase> theDatatype,
+ Class extends Enum>> theBinderType) {
super(theField, theElementName, theDescriptionAnnotation, theChildAnnotation, theDatatype);
myEnumType = theBinderType;
@@ -64,5 +70,4 @@ public class RuntimeChildPrimitiveEnumerationDatatypeDefinition extends RuntimeC
}
return retVal;
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildResourceBlockDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildResourceBlockDefinition.java
index 54c543c0f94..a3862bfeeff 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildResourceBlockDefinition.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildResourceBlockDefinition.java
@@ -19,23 +19,29 @@
*/
package ca.uhn.fhir.context;
+import ca.uhn.fhir.model.api.annotation.Child;
+import ca.uhn.fhir.model.api.annotation.Description;
+import org.hl7.fhir.instance.model.api.IBase;
+
import java.lang.reflect.Field;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
-import org.hl7.fhir.instance.model.api.IBase;
-
-import ca.uhn.fhir.model.api.annotation.Child;
-import ca.uhn.fhir.model.api.annotation.Description;
-
public class RuntimeChildResourceBlockDefinition extends BaseRuntimeDeclaredChildDefinition {
-// private RuntimeResourceBlockDefinition myElementDef;
+ // private RuntimeResourceBlockDefinition myElementDef;
private Class extends IBase> myResourceBlockType;
private FhirContext myContext;
- public RuntimeChildResourceBlockDefinition(FhirContext theContext, Field theField, Child theChildAnnotation, Description theDescriptionAnnotation, String theElementName, Class extends IBase> theResourceBlockType) throws ConfigurationException {
+ public RuntimeChildResourceBlockDefinition(
+ FhirContext theContext,
+ Field theField,
+ Child theChildAnnotation,
+ Description theDescriptionAnnotation,
+ String theElementName,
+ Class extends IBase> theResourceBlockType)
+ throws ConfigurationException {
super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName);
myContext = theContext;
myResourceBlockType = theResourceBlockType;
@@ -75,8 +81,9 @@ public class RuntimeChildResourceBlockDefinition extends BaseRuntimeDeclaredChil
}
@Override
- void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
-// myElementDef = (RuntimeResourceBlockDefinition) theClassToElementDefinitions.get(myResourceBlockType);
+ void sealAndInitialize(
+ FhirContext theContext,
+ Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
+ // myElementDef = (RuntimeResourceBlockDefinition) theClassToElementDefinitions.get(myResourceBlockType);
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildResourceDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildResourceDefinition.java
index 47e0f738561..6fc8987c6cd 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildResourceDefinition.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildResourceDefinition.java
@@ -42,7 +42,12 @@ public class RuntimeChildResourceDefinition extends BaseRuntimeDeclaredChildDefi
/**
* Constructor
*/
- public RuntimeChildResourceDefinition(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation, List> theResourceTypes) {
+ public RuntimeChildResourceDefinition(
+ Field theField,
+ String theElementName,
+ Child theChildAnnotation,
+ Description theDescriptionAnnotation,
+ List> theResourceTypes) {
super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName);
myResourceTypes = theResourceTypes;
@@ -79,12 +84,14 @@ public class RuntimeChildResourceDefinition extends BaseRuntimeDeclaredChildDefi
}
@Override
- void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
+ void sealAndInitialize(
+ FhirContext theContext,
+ Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
myRuntimeDef = findResourceReferenceDefinition(theClassToElementDefinitions);
myValidChildNames = new HashSet();
myValidChildNames.add(getElementName());
-
+
/*
* [elementName]Resource is not actually valid FHIR but we've encountered it in the wild
* so we'll accept it just to be nice
@@ -94,26 +101,28 @@ public class RuntimeChildResourceDefinition extends BaseRuntimeDeclaredChildDefi
/*
* Below has been disabled- We used to allow field names to contain the name of the resource
* that they accepted. This wasn't valid but we accepted it just to be flexible because there
- * were some bad examples containing this. This causes conflicts with actual field names in
- * recent definitions though, so it has been disabled as of HAPI 0.9
+ * were some bad examples containing this. This causes conflicts with actual field names in
+ * recent definitions though, so it has been disabled as of HAPI 0.9
*/
-// for (Class extends IBaseResource> next : myResourceTypes) {
-// if (next == IResource.class) {
-// for (Entry, BaseRuntimeElementDefinition>> nextEntry : theClassToElementDefinitions.entrySet()) {
-// if (IResource.class.isAssignableFrom(nextEntry.getKey())) {
-// RuntimeResourceDefinition nextDef = (RuntimeResourceDefinition) nextEntry.getValue();
-// myValidChildNames.add(getElementName() + nextDef.getName());
-// }
-// }
-// }
-// else {
-// RuntimeResourceDefinition nextDef = (RuntimeResourceDefinition) theClassToElementDefinitions.get(next);
-// if (nextDef == null) {
-// throw new ConfigurationException(Msg.code(1691) + "Can't find child of type: " + next.getCanonicalName() + " in " + getField().getDeclaringClass());
-// }
-// myValidChildNames.add(getElementName() + nextDef.getName());
-// }
-// }
+ // for (Class extends IBaseResource> next : myResourceTypes) {
+ // if (next == IResource.class) {
+ // for (Entry, BaseRuntimeElementDefinition>> nextEntry :
+ // theClassToElementDefinitions.entrySet()) {
+ // if (IResource.class.isAssignableFrom(nextEntry.getKey())) {
+ // RuntimeResourceDefinition nextDef = (RuntimeResourceDefinition) nextEntry.getValue();
+ // myValidChildNames.add(getElementName() + nextDef.getName());
+ // }
+ // }
+ // }
+ // else {
+ // RuntimeResourceDefinition nextDef = (RuntimeResourceDefinition) theClassToElementDefinitions.get(next);
+ // if (nextDef == null) {
+ // throw new ConfigurationException(Msg.code(1691) + "Can't find child of type: " + next.getCanonicalName()
+ // + " in " + getField().getDeclaringClass());
+ // }
+ // myValidChildNames.add(getElementName() + nextDef.getName());
+ // }
+ // }
myResourceTypes = Collections.unmodifiableList(myResourceTypes);
myValidChildNames = Collections.unmodifiableSet(myValidChildNames);
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildUndeclaredExtensionDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildUndeclaredExtensionDefinition.java
index 7a69e18c45d..d76ee7ebfa2 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildUndeclaredExtensionDefinition.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildUndeclaredExtensionDefinition.java
@@ -37,7 +37,8 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
private static final String VALUE_REFERENCE = "valueReference";
private static final String VALUE_RESOURCE = "valueResource";
- private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RuntimeChildUndeclaredExtensionDefinition.class);
+ private static final org.slf4j.Logger ourLog =
+ org.slf4j.LoggerFactory.getLogger(RuntimeChildUndeclaredExtensionDefinition.class);
private Map> myAttributeNameToDefinition;
private Map, String> myDatatypeToAttributeName;
private Map, BaseRuntimeElementDefinition>> myDatatypeToDefinition;
@@ -46,7 +47,10 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
// nothing
}
- private void addReferenceBinding(FhirContext theContext, Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions, String value) {
+ private void addReferenceBinding(
+ FhirContext theContext,
+ Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions,
+ String value) {
BaseRuntimeElementDefinition> def = findResourceReferenceDefinition(theClassToElementDefinitions);
myAttributeNameToDefinition.put(value, def);
@@ -58,7 +62,6 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
myDatatypeToDefinition.put(BaseResourceReferenceDt.class, def);
myDatatypeToDefinition.put(theContext.getVersion().getResourceReferenceType(), def);
}
-
}
@Override
@@ -72,7 +75,6 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
}
return new ArrayList<>(target.getUndeclaredExtensions());
}
-
};
}
@@ -134,7 +136,9 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
}
@Override
- void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
+ void sealAndInitialize(
+ FhirContext theContext,
+ Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
Map> datatypeAttributeNameToDefinition = new HashMap<>();
myDatatypeToAttributeName = new HashMap<>();
myDatatypeToDefinition = new HashMap<>();
@@ -149,7 +153,6 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
ourLog.trace("Not adding specialization: {}", next.getImplementingClass());
}
-
if (!next.isStandardType()) {
continue;
}
@@ -180,7 +183,10 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
// CodeType should win. If we aren't in a situation like that, there is a problem with the
// model so we should bail.
if (!existing.isStandardType()) {
- throw new ConfigurationException(Msg.code(1734) + "More than one child of " + getElementName() + " matches attribute name " + attrName + ". Found [" + existing.getImplementingClass().getName() + "] and [" + next.getImplementingClass().getName() + "]");
+ throw new ConfigurationException(Msg.code(1734) + "More than one child of " + getElementName()
+ + " matches attribute name " + attrName + ". Found ["
+ + existing.getImplementingClass().getName() + "] and ["
+ + next.getImplementingClass().getName() + "]");
}
}
@@ -192,7 +198,6 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
myAttributeNameToDefinition = datatypeAttributeNameToDefinition;
-
/*
* Resource reference - The correct name is 'valueReference' in DSTU2 and 'valueResource' in DSTU1
*/
@@ -203,5 +208,4 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
public static String createExtensionChildName(BaseRuntimeElementDefinition> next) {
return "value" + WordUtils.capitalize(next.getName());
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeCompositeDatatypeDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeCompositeDatatypeDefinition.java
index 7309d73fa60..8df563ddada 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeCompositeDatatypeDefinition.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeCompositeDatatypeDefinition.java
@@ -30,32 +30,40 @@ import java.util.Map;
import static org.apache.commons.lang3.StringUtils.isBlank;
-public class RuntimeCompositeDatatypeDefinition extends BaseRuntimeElementCompositeDefinition implements IRuntimeDatatypeDefinition {
+public class RuntimeCompositeDatatypeDefinition extends BaseRuntimeElementCompositeDefinition
+ implements IRuntimeDatatypeDefinition {
private boolean mySpecialization;
private Class extends IBaseDatatype> myProfileOfType;
private BaseRuntimeElementDefinition> myProfileOf;
- public RuntimeCompositeDatatypeDefinition(DatatypeDef theDef, Class extends ICompositeType> theImplementingClass, boolean theStandardType, FhirContext theContext, Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
+ public RuntimeCompositeDatatypeDefinition(
+ DatatypeDef theDef,
+ Class extends ICompositeType> theImplementingClass,
+ boolean theStandardType,
+ FhirContext theContext,
+ Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
super(theDef.name(), theImplementingClass, theStandardType, theContext, theClassToElementDefinitions);
-
+
String resourceName = theDef.name();
if (isBlank(resourceName)) {
- throw new ConfigurationException(Msg.code(1712) + "Resource type @" + ResourceDef.class.getSimpleName() + " annotation contains no resource name: " + theImplementingClass.getCanonicalName());
+ throw new ConfigurationException(Msg.code(1712) + "Resource type @" + ResourceDef.class.getSimpleName()
+ + " annotation contains no resource name: " + theImplementingClass.getCanonicalName());
}
-
+
mySpecialization = theDef.isSpecialization();
myProfileOfType = theDef.profileOf();
if (myProfileOfType.equals(IBaseDatatype.class)) {
myProfileOfType = null;
}
-
}
@Override
- public void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
+ public void sealAndInitialize(
+ FhirContext theContext,
+ Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
super.sealAndInitialize(theContext, theClassToElementDefinitions);
-
+
if (myProfileOfType != null) {
myProfileOf = theClassToElementDefinitions.get(myProfileOfType);
if (myProfileOf == null) {
@@ -91,6 +99,4 @@ public class RuntimeCompositeDatatypeDefinition extends BaseRuntimeElementCompos
}
return false;
}
-
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeElemContainedResourceList.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeElemContainedResourceList.java
index e8ad9eefc26..7538a6c3d1b 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeElemContainedResourceList.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeElemContainedResourceList.java
@@ -22,7 +22,7 @@ package ca.uhn.fhir.context;
import org.hl7.fhir.instance.model.api.IBaseResource;
/**
- * HL7org structures use a List for contained instead of a distinct datatype
+ * HL7org structures use a List for contained instead of a distinct datatype
*/
public class RuntimeElemContainedResourceList extends BaseRuntimeElementDefinition {
@@ -34,5 +34,4 @@ public class RuntimeElemContainedResourceList extends BaseRuntimeElementDefiniti
public ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum getChildType() {
return ChildTypeEnum.CONTAINED_RESOURCE_LIST;
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeElemContainedResources.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeElemContainedResources.java
index 9ef2d9117bd..66a623823f6 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeElemContainedResources.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeElemContainedResources.java
@@ -32,5 +32,4 @@ public class RuntimeElemContainedResources extends BaseRuntimeElementDefinition<
public ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum getChildType() {
return ChildTypeEnum.CONTAINED_RESOURCES;
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeElementDirectResource.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeElementDirectResource.java
index 4fadae7243e..4857a566328 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeElementDirectResource.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeElementDirectResource.java
@@ -31,5 +31,4 @@ public class RuntimeElementDirectResource extends BaseRuntimeElementDefinition myChildren;
- public RuntimeExtensionDtDefinition(DatatypeDef theDef, Class extends ICompositeType> theImplementingClass, boolean theStandardType, FhirContext theContext, Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
+ public RuntimeExtensionDtDefinition(
+ DatatypeDef theDef,
+ Class extends ICompositeType> theImplementingClass,
+ boolean theStandardType,
+ FhirContext theContext,
+ Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
super(theDef, theImplementingClass, theStandardType, theContext, theClassToElementDefinitions);
}
@@ -47,14 +51,16 @@ public class RuntimeExtensionDtDefinition extends RuntimeCompositeDatatypeDefini
}
@Override
- public void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
+ public void sealAndInitialize(
+ FhirContext theContext,
+ Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
super.sealAndInitialize(theContext, theClassToElementDefinitions);
-
+
/*
* The "url" child is a weird child because it is not parsed and encoded in the normal way,
- * so we exclude it here
+ * so we exclude it here
*/
-
+
List superChildren = super.getChildren();
ArrayList children = new ArrayList();
for (BaseRuntimeChildDefinition baseRuntimeChildDefinition : superChildren) {
@@ -63,8 +69,7 @@ public class RuntimeExtensionDtDefinition extends RuntimeCompositeDatatypeDefini
}
children.add(baseRuntimeChildDefinition);
}
-
+
myChildren = Collections.unmodifiableList(children);
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeIdDatatypeDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeIdDatatypeDefinition.java
index dce07479870..8feaee1e2c8 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeIdDatatypeDefinition.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeIdDatatypeDefinition.java
@@ -19,13 +19,14 @@
*/
package ca.uhn.fhir.context;
+import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
-import ca.uhn.fhir.model.api.annotation.DatatypeDef;
+public class RuntimeIdDatatypeDefinition extends RuntimePrimitiveDatatypeDefinition
+ implements IRuntimeDatatypeDefinition {
-public class RuntimeIdDatatypeDefinition extends RuntimePrimitiveDatatypeDefinition implements IRuntimeDatatypeDefinition {
-
- public RuntimeIdDatatypeDefinition(DatatypeDef theDef, Class extends IPrimitiveType>> theImplementingClass, boolean theStandardType) {
+ public RuntimeIdDatatypeDefinition(
+ DatatypeDef theDef, Class extends IPrimitiveType>> theImplementingClass, boolean theStandardType) {
super(theDef, theImplementingClass, theStandardType);
}
@@ -33,5 +34,4 @@ public class RuntimeIdDatatypeDefinition extends RuntimePrimitiveDatatypeDefinit
public ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum getChildType() {
return ChildTypeEnum.ID_DATATYPE;
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimePrimitiveDatatypeDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimePrimitiveDatatypeDefinition.java
index 664e56d3b70..cedc7ec918b 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimePrimitiveDatatypeDefinition.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimePrimitiveDatatypeDefinition.java
@@ -35,7 +35,8 @@ import java.util.Map;
import static org.apache.commons.lang3.StringUtils.isBlank;
-public class RuntimePrimitiveDatatypeDefinition extends BaseRuntimeElementDefinition> implements IRuntimeDatatypeDefinition {
+public class RuntimePrimitiveDatatypeDefinition extends BaseRuntimeElementDefinition>
+ implements IRuntimeDatatypeDefinition {
private Class> myNativeType;
private BaseRuntimeElementDefinition> myProfileOf;
@@ -44,12 +45,14 @@ public class RuntimePrimitiveDatatypeDefinition extends BaseRuntimeElementDefini
private List myChildren;
private RuntimeChildExt myRuntimeChildExt;
- public RuntimePrimitiveDatatypeDefinition(DatatypeDef theDef, Class extends IPrimitiveType>> theImplementingClass, boolean theStandardType) {
+ public RuntimePrimitiveDatatypeDefinition(
+ DatatypeDef theDef, Class extends IPrimitiveType>> theImplementingClass, boolean theStandardType) {
super(theDef.name(), theImplementingClass, theStandardType);
String resourceName = theDef.name();
if (isBlank(resourceName)) {
- throw new ConfigurationException(Msg.code(1689) + "Resource type @" + ResourceDef.class.getSimpleName() + " annotation contains no resource name: " + theImplementingClass.getCanonicalName());
+ throw new ConfigurationException(Msg.code(1689) + "Resource type @" + ResourceDef.class.getSimpleName()
+ + " annotation contains no resource name: " + theImplementingClass.getCanonicalName());
}
mySpecialization = theDef.isSpecialization();
@@ -83,7 +86,8 @@ public class RuntimePrimitiveDatatypeDefinition extends BaseRuntimeElementDefini
Type rawType = superPt.getRawType();
if (rawType instanceof Class) {
Class> rawClass = (Class>) rawType;
- if (rawClass.getName().endsWith(".BasePrimitive") || rawClass.getName().endsWith(".PrimitiveType")) {
+ if (rawClass.getName().endsWith(".BasePrimitive")
+ || rawClass.getName().endsWith(".PrimitiveType")) {
Type typeVariable = superPt.getActualTypeArguments()[0];
if (typeVariable instanceof Class) {
myNativeType = (Class>) typeVariable;
@@ -128,7 +132,9 @@ public class RuntimePrimitiveDatatypeDefinition extends BaseRuntimeElementDefini
}
@Override
- void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
+ void sealAndInitialize(
+ FhirContext theContext,
+ Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
super.sealAndInitialize(theContext, theClassToElementDefinitions);
if (myProfileOfType != null) {
@@ -153,5 +159,4 @@ public class RuntimePrimitiveDatatypeDefinition extends BaseRuntimeElementDefini
myChildren.add(myRuntimeChildExt);
myChildren = Collections.unmodifiableList(myChildren);
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimePrimitiveDatatypeNarrativeDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimePrimitiveDatatypeNarrativeDefinition.java
index 5c29d6a716e..f4e12118b7f 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimePrimitiveDatatypeNarrativeDefinition.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimePrimitiveDatatypeNarrativeDefinition.java
@@ -19,15 +19,15 @@
*/
package ca.uhn.fhir.context;
-import java.util.Map;
-
+import ca.uhn.fhir.model.primitive.XhtmlDt;
import org.hl7.fhir.instance.model.api.IBase;
-import ca.uhn.fhir.model.primitive.XhtmlDt;
+import java.util.Map;
-public class RuntimePrimitiveDatatypeNarrativeDefinition extends BaseRuntimeElementDefinition {
+public class RuntimePrimitiveDatatypeNarrativeDefinition extends BaseRuntimeElementDefinition {
- public RuntimePrimitiveDatatypeNarrativeDefinition(String theName, Class theImplementingClass, boolean theStandardType) {
+ public RuntimePrimitiveDatatypeNarrativeDefinition(
+ String theName, Class theImplementingClass, boolean theStandardType) {
super(theName, theImplementingClass, theStandardType);
}
@@ -37,8 +37,9 @@ public class RuntimePrimitiveDatatypeNarrativeDefinition extends BaseRuntimeEle
}
@Override
- void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
+ void sealAndInitialize(
+ FhirContext theContext,
+ Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
// nothing
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimePrimitiveDatatypeXhtmlHl7OrgDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimePrimitiveDatatypeXhtmlHl7OrgDefinition.java
index dbc81d960ca..adc80ca73ec 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimePrimitiveDatatypeXhtmlHl7OrgDefinition.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimePrimitiveDatatypeXhtmlHl7OrgDefinition.java
@@ -19,14 +19,15 @@
*/
package ca.uhn.fhir.context;
-import java.util.Map;
-
import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IBaseXhtml;
-public class RuntimePrimitiveDatatypeXhtmlHl7OrgDefinition extends BaseRuntimeElementDefinition {
+import java.util.Map;
- public RuntimePrimitiveDatatypeXhtmlHl7OrgDefinition(String theName, Class extends IBaseXhtml> theImplementingClass, boolean theStandardType) {
+public class RuntimePrimitiveDatatypeXhtmlHl7OrgDefinition extends BaseRuntimeElementDefinition {
+
+ public RuntimePrimitiveDatatypeXhtmlHl7OrgDefinition(
+ String theName, Class extends IBaseXhtml> theImplementingClass, boolean theStandardType) {
super(theName, theImplementingClass, theStandardType);
}
@@ -36,8 +37,9 @@ public class RuntimePrimitiveDatatypeXhtmlHl7OrgDefinition extends BaseRuntimeE
}
@Override
- void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
+ void sealAndInitialize(
+ FhirContext theContext,
+ Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
// nothing
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceBlockDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceBlockDefinition.java
index 693000f8dd8..2477d38b6b0 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceBlockDefinition.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceBlockDefinition.java
@@ -19,13 +19,18 @@
*/
package ca.uhn.fhir.context;
-import java.util.Map;
-
import org.hl7.fhir.instance.model.api.IBase;
+import java.util.Map;
+
public class RuntimeResourceBlockDefinition extends BaseRuntimeElementCompositeDefinition {
- public RuntimeResourceBlockDefinition(String theName, Class extends IBase> theImplementingClass, boolean theStandardType, FhirContext theContext, Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
+ public RuntimeResourceBlockDefinition(
+ String theName,
+ Class extends IBase> theImplementingClass,
+ boolean theStandardType,
+ FhirContext theContext,
+ Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
super(theName, theImplementingClass, theStandardType, theContext, theClassToElementDefinitions);
}
@@ -33,5 +38,4 @@ public class RuntimeResourceBlockDefinition extends BaseRuntimeElementCompositeD
public ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum getChildType() {
return ChildTypeEnum.RESOURCE_BLOCK;
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceDefinition.java
index 5e520ad95e2..758fd51ac9c 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceDefinition.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceDefinition.java
@@ -48,9 +48,13 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini
private final FhirVersionEnum myStructureVersion;
private volatile RuntimeResourceDefinition myBaseDefinition;
-
-
- public RuntimeResourceDefinition(FhirContext theContext, String theResourceName, Class extends IBaseResource> theClass, ResourceDef theResourceAnnotation, boolean theStandardType, Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
+ public RuntimeResourceDefinition(
+ FhirContext theContext,
+ String theResourceName,
+ Class extends IBaseResource> theClass,
+ ResourceDef theResourceAnnotation,
+ boolean theStandardType,
+ Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
super(theResourceName, theClass, theStandardType, theContext, theClassToElementDefinitions);
myContext = theContext;
myResourceProfile = theResourceAnnotation.profile();
@@ -60,23 +64,35 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini
try {
instance = theClass.getConstructor().newInstance();
} catch (Exception e) {
- throw new ConfigurationException(Msg.code(1730) + myContext.getLocalizer().getMessage(getClass(), "nonInstantiableType", theClass.getName(), e.toString()), e);
+ throw new ConfigurationException(
+ Msg.code(1730)
+ + myContext
+ .getLocalizer()
+ .getMessage(getClass(), "nonInstantiableType", theClass.getName(), e.toString()),
+ e);
}
myStructureVersion = instance.getStructureFhirVersionEnum();
if (myStructureVersion != theContext.getVersion().getVersion()) {
- if (myStructureVersion == FhirVersionEnum.R5 && theContext.getVersion().getVersion() == FhirVersionEnum.R4B) {
+ if (myStructureVersion == FhirVersionEnum.R5
+ && theContext.getVersion().getVersion() == FhirVersionEnum.R4B) {
// TODO: remove this exception once we've bumped FHIR core to a new version
// TODO: also fix the TODO in ModelScanner
// TODO: also fix the TODO in RestfulServerUtils
// TODO: also fix the TODO in BaseParser
} else {
- throw new ConfigurationException(Msg.code(1731) + myContext.getLocalizer().getMessage(getClass(), "typeWrongVersion", theContext.getVersion().getVersion(), theClass.getName(), myStructureVersion));
+ throw new ConfigurationException(Msg.code(1731)
+ + myContext
+ .getLocalizer()
+ .getMessage(
+ getClass(),
+ "typeWrongVersion",
+ theContext.getVersion().getVersion(),
+ theClass.getName(),
+ myStructureVersion));
}
}
-
}
-
public void addSearchParam(RuntimeSearchParam theParam) {
myNameToSearchParam.put(theParam.getName(), theParam);
}
@@ -113,7 +129,8 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini
@SuppressWarnings("unchecked")
public Class getImplementingClass(Class theClass) {
if (!theClass.isAssignableFrom(getImplementingClass())) {
- throw new ConfigurationException(Msg.code(1732) + "Unable to convert " + getImplementingClass() + " to " + theClass);
+ throw new ConfigurationException(
+ Msg.code(1732) + "Unable to convert " + getImplementingClass() + " to " + theClass);
}
return (Class) getImplementingClass();
}
@@ -176,7 +193,9 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini
@SuppressWarnings("unchecked")
@Override
- public void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
+ public void sealAndInitialize(
+ FhirContext theContext,
+ Map, BaseRuntimeElementDefinition>> theClassToElementDefinitions) {
super.sealAndInitialize(theContext, theClassToElementDefinitions);
myNameToSearchParam = Collections.unmodifiableMap(myNameToSearchParam);
@@ -202,7 +221,8 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini
if (!compartmentNameToSearchParams.containsKey(nextCompartment)) {
compartmentNameToSearchParams.put(nextCompartment, new ArrayList<>());
}
- List searchParamsForCompartment = compartmentNameToSearchParams.get(nextCompartment);
+ List searchParamsForCompartment =
+ compartmentNameToSearchParams.get(nextCompartment);
searchParamsForCompartment.add(next);
/*
@@ -239,7 +259,7 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini
myBaseType = (Class extends IBaseResource>) target;
}
} while (target.equals(Object.class) == false);
-
+
/*
* See #504:
* Bundle types may not have extensions
@@ -247,11 +267,11 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini
if (hasExtensions()) {
if (IAnyResource.class.isAssignableFrom(getImplementingClass())) {
if (!IDomainResource.class.isAssignableFrom(getImplementingClass())) {
- throw new ConfigurationException(Msg.code(1733) + "Class \"" + getImplementingClass() + "\" is invalid. This resource type is not a DomainResource, it must not have extensions");
+ throw new ConfigurationException(Msg.code(1733) + "Class \"" + getImplementingClass()
+ + "\" is invalid. This resource type is not a DomainResource, it must not have extensions");
}
}
}
-
}
private String massagePathForCompartmentSimilarity(String thePath) {
@@ -286,5 +306,4 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini
return retVal;
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeSearchParam.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeSearchParam.java
index 2dc1220b4c9..cba53cb118c 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeSearchParam.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeSearchParam.java
@@ -20,7 +20,6 @@
package ca.uhn.fhir.context;
import ca.uhn.fhir.context.phonetic.IPhoneticEncoder;
-import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
@@ -28,10 +27,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hl7.fhir.instance.model.api.IBaseExtension;
import org.hl7.fhir.instance.model.api.IIdType;
-import org.hl7.fhir.instance.model.api.IPrimitiveType;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -39,9 +35,10 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
import java.util.Set;
import java.util.StringTokenizer;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import static org.apache.commons.lang3.StringUtils.trim;
@@ -66,22 +63,67 @@ public class RuntimeSearchParam {
/**
* Constructor
*/
- public RuntimeSearchParam(IIdType theId, String theUri, String theName, String theDescription, String thePath, RestSearchParameterTypeEnum theParamType,
- Set theProvidesMembershipInCompartments, Set theTargets, RuntimeSearchParamStatusEnum theStatus, Collection theBase) {
- this(theId, theUri, theName, theDescription, thePath, theParamType, theProvidesMembershipInCompartments, theTargets, theStatus, null, Collections.emptyList(), theBase);
+ public RuntimeSearchParam(
+ IIdType theId,
+ String theUri,
+ String theName,
+ String theDescription,
+ String thePath,
+ RestSearchParameterTypeEnum theParamType,
+ Set theProvidesMembershipInCompartments,
+ Set theTargets,
+ RuntimeSearchParamStatusEnum theStatus,
+ Collection theBase) {
+ this(
+ theId,
+ theUri,
+ theName,
+ theDescription,
+ thePath,
+ theParamType,
+ theProvidesMembershipInCompartments,
+ theTargets,
+ theStatus,
+ null,
+ Collections.emptyList(),
+ theBase);
}
/**
* Copy constructor
*/
public RuntimeSearchParam(RuntimeSearchParam theSp) {
- this(theSp.getId(), theSp.getUri(), theSp.getName(), theSp.getDescription(), theSp.getPath(), theSp.getParamType(), theSp.getProvidesMembershipInCompartments(), theSp.getTargets(), theSp.getStatus(), theSp.getComboSearchParamType(), theSp.getComponents(), theSp.getBase());
+ this(
+ theSp.getId(),
+ theSp.getUri(),
+ theSp.getName(),
+ theSp.getDescription(),
+ theSp.getPath(),
+ theSp.getParamType(),
+ theSp.getProvidesMembershipInCompartments(),
+ theSp.getTargets(),
+ theSp.getStatus(),
+ theSp.getComboSearchParamType(),
+ theSp.getComponents(),
+ theSp.getBase());
}
/**
* Constructor
*/
- public RuntimeSearchParam(IIdType theId, String theUri, String theName, String theDescription, String thePath, RestSearchParameterTypeEnum theParamType, Set theProvidesMembershipInCompartments, Set theTargets, RuntimeSearchParamStatusEnum theStatus, ComboSearchParamType theComboSearchParamType, List theComponents, Collection theBase) {
+ public RuntimeSearchParam(
+ IIdType theId,
+ String theUri,
+ String theName,
+ String theDescription,
+ String thePath,
+ RestSearchParameterTypeEnum theParamType,
+ Set theProvidesMembershipInCompartments,
+ Set theTargets,
+ RuntimeSearchParamStatusEnum theStatus,
+ ComboSearchParamType theComboSearchParamType,
+ List theComponents,
+ Collection theBase) {
super();
myId = theId;
@@ -160,12 +202,12 @@ public class RuntimeSearchParam {
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
- .append("base", myBase)
- .append("name", myName)
- .append("path", myPath)
- .append("id", myId)
- .append("uri", myUri)
- .toString();
+ .append("base", myBase)
+ .append("name", myName)
+ .append("path", myPath)
+ .append("id", myId)
+ .append("uri", myUri)
+ .toString();
}
public IIdType getId() {
@@ -185,21 +227,21 @@ public class RuntimeSearchParam {
RuntimeSearchParam that = (RuntimeSearchParam) theO;
return new EqualsBuilder()
- .append(getId(), that.getId())
- .append(getName(), that.getName())
- .append(getPath(), that.getPath())
- .append(getUri(), that.getUri())
- .isEquals();
+ .append(getId(), that.getId())
+ .append(getName(), that.getName())
+ .append(getPath(), that.getPath())
+ .append(getUri(), that.getUri())
+ .isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
- .append(getId())
- .append(getName())
- .append(getPath())
- .append(getUri())
- .toHashCode();
+ .append(getId())
+ .append(getName())
+ .append(getPath())
+ .append(getUri())
+ .toHashCode();
}
public Set getBase() {
@@ -375,15 +417,14 @@ public class RuntimeSearchParam {
public Component(String theExpression, String theReference) {
myExpression = theExpression;
myReference = theReference;
-
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
- .append("expression", myExpression)
- .append("reference", myReference)
- .toString();
+ .append("expression", myExpression)
+ .append("reference", myReference)
+ .toString();
}
public String getExpression() {
@@ -394,5 +435,4 @@ public class RuntimeSearchParam {
return myReference;
}
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/api/AddProfileTagEnum.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/api/AddProfileTagEnum.java
index ed3b50af11e..b383746547b 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/api/AddProfileTagEnum.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/api/AddProfileTagEnum.java
@@ -23,7 +23,7 @@ import ca.uhn.fhir.context.FhirContext;
/**
* RESTful server behaviour for automatically adding profile tags when serializing resources
- *
+ *
* @see FhirContext#setAddProfileTagWhenEncoding(AddProfileTagEnum)
*/
public enum AddProfileTagEnum {
@@ -34,7 +34,7 @@ public enum AddProfileTagEnum {
/**
* Add any profile tags that returned resources appear to conform to
- *
+ *
* @deprecated This mode causes even FHIR's default profiles to be exported in the
* resource metadata section. This is not generally expected behaviour from other
* systems and it offers no real benefit, so it will be removed at some point. This
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/api/BundleInclusionRule.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/api/BundleInclusionRule.java
index e7e951996e6..4488a821045 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/api/BundleInclusionRule.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/api/BundleInclusionRule.java
@@ -19,18 +19,18 @@
*/
package ca.uhn.fhir.context.api;
-import java.util.Set;
-
import ca.uhn.fhir.model.api.Include;
import ca.uhn.fhir.util.ResourceReferenceInfo;
+import java.util.Set;
+
/**
* Created by Bill de Beaubien on 3/4/2015.
*
* Controls how bundles decide whether referenced resources should be included
*/
public enum BundleInclusionRule {
-
+
/**
* Decision is based on whether the resource's Include is in the IncludeSet (e.g. DiagnosticReport.result). Note that the resource has to be populated to be included.
*
@@ -38,7 +38,8 @@ public enum BundleInclusionRule {
*/
BASED_ON_INCLUDES {
@Override
- public boolean shouldIncludeReferencedResource(ResourceReferenceInfo theReferenceInfo, Set theIncludes) {
+ public boolean shouldIncludeReferencedResource(
+ ResourceReferenceInfo theReferenceInfo, Set theIncludes) {
return theReferenceInfo.matchesIncludeSet(theIncludes);
}
},
@@ -50,10 +51,12 @@ public enum BundleInclusionRule {
*/
BASED_ON_RESOURCE_PRESENCE {
@Override
- public boolean shouldIncludeReferencedResource(ResourceReferenceInfo theReferenceInfo, Set theIncludes) {
+ public boolean shouldIncludeReferencedResource(
+ ResourceReferenceInfo theReferenceInfo, Set theIncludes) {
return true;
}
};
- public abstract boolean shouldIncludeReferencedResource(ResourceReferenceInfo theReferenceInfo, Set theIncludes);
+ public abstract boolean shouldIncludeReferencedResource(
+ ResourceReferenceInfo theReferenceInfo, Set theIncludes);
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/phonetic/ApacheEncoder.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/phonetic/ApacheEncoder.java
index a7517afb9ac..0257e4db986 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/phonetic/ApacheEncoder.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/phonetic/ApacheEncoder.java
@@ -46,7 +46,8 @@ public class ApacheEncoder implements IPhoneticEncoder {
@Override
public String encode(String theString) {
try {
- // If the string contains a space, encode alpha parts separately so, for example, numbers are preserved in address lines.
+ // If the string contains a space, encode alpha parts separately so, for example, numbers are preserved in
+ // address lines.
if (theString.contains(" ")) {
return encodeStringWithSpaces(theString);
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/phonetic/NumericEncoder.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/phonetic/NumericEncoder.java
index 2976bf30aa5..a97bff3ef26 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/phonetic/NumericEncoder.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/phonetic/NumericEncoder.java
@@ -22,7 +22,8 @@ package ca.uhn.fhir.context.phonetic;
import com.google.common.base.CharMatcher;
// Useful for numerical identifiers like phone numbers, address parts etc.
-// This should not be used where decimals are important. A new "quantity encoder" should be added to handle cases like that.
+// This should not be used where decimals are important. A new "quantity encoder" should be added to handle cases like
+// that.
public class NumericEncoder implements IPhoneticEncoder {
@Override
public String name() {
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/ConceptValidationOptions.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/ConceptValidationOptions.java
index ee52d348bb0..d8223c6ba4f 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/ConceptValidationOptions.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/ConceptValidationOptions.java
@@ -39,8 +39,8 @@ public class ConceptValidationOptions {
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
- .append("inferSystem", myInferSystem)
- .toString();
+ .append("inferSystem", myInferSystem)
+ .toString();
}
public boolean isValidateDisplay() {
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/DefaultProfileValidationSupport.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/DefaultProfileValidationSupport.java
index 77c8bab0e08..4a103500ebf 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/DefaultProfileValidationSupport.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/DefaultProfileValidationSupport.java
@@ -27,12 +27,12 @@ import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
-import javax.annotation.Nullable;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import javax.annotation.Nullable;
/**
* This class returns the vocabulary that is shipped with the base FHIR
@@ -46,13 +46,15 @@ import java.util.Optional;
*/
public class DefaultProfileValidationSupport implements IValidationSupport {
- private static final Map ourImplementations = Collections.synchronizedMap(new HashMap<>());
+ private static final Map ourImplementations =
+ Collections.synchronizedMap(new HashMap<>());
private final FhirContext myCtx;
/**
* This module just delegates all calls to a concrete implementation which will
* be in this field. Which implementation gets used depends on the FHIR version.
*/
private final IValidationSupport myDelegate;
+
private final Runnable myFlush;
/**
@@ -76,8 +78,12 @@ public class DefaultProfileValidationSupport implements IValidationSupport {
* make this hard to clean up. At some point it'd be nice to figure out
* a cleaner solution though.
*/
- strategy = ReflectionUtil.newInstance("org.hl7.fhir.common.hapi.validation.support.DefaultProfileValidationSupportNpmStrategy", IValidationSupport.class, new Class[]{FhirContext.class}, new Object[]{theFhirContext});
- ((ILockable)strategy).lock();
+ strategy = ReflectionUtil.newInstance(
+ "org.hl7.fhir.common.hapi.validation.support.DefaultProfileValidationSupportNpmStrategy",
+ IValidationSupport.class,
+ new Class[] {FhirContext.class},
+ new Object[] {theFhirContext});
+ ((ILockable) strategy).lock();
} else {
strategy = new DefaultProfileValidationSupportBundleStrategy(theFhirContext);
}
@@ -87,9 +93,9 @@ public class DefaultProfileValidationSupport implements IValidationSupport {
myDelegate = strategy;
if (myDelegate instanceof DefaultProfileValidationSupportBundleStrategy) {
- myFlush = ()->((DefaultProfileValidationSupportBundleStrategy) myDelegate).flush();
+ myFlush = () -> ((DefaultProfileValidationSupportBundleStrategy) myDelegate).flush();
} else {
- myFlush = ()->{};
+ myFlush = () -> {};
}
}
@@ -109,7 +115,6 @@ public class DefaultProfileValidationSupport implements IValidationSupport {
return myDelegate.fetchAllNonBaseStructureDefinitions();
}
-
@Override
public IBaseResource fetchCodeSystem(String theSystem) {
return myDelegate.fetchCodeSystem(theSystem);
@@ -134,17 +139,18 @@ public class DefaultProfileValidationSupport implements IValidationSupport {
return myCtx;
}
-
@Nullable
public static String getConformanceResourceUrl(FhirContext theFhirContext, IBaseResource theResource) {
String urlValueString = null;
- Optional urlValue = theFhirContext.getResourceDefinition(theResource).getChildByName("url").getAccessor().getFirstValueOrNull(theResource);
+ Optional urlValue = theFhirContext
+ .getResourceDefinition(theResource)
+ .getChildByName("url")
+ .getAccessor()
+ .getFirstValueOrNull(theResource);
if (urlValue.isPresent()) {
IPrimitiveType> urlValueType = (IPrimitiveType>) urlValue.get();
urlValueString = urlValueType.getValueAsString();
}
return urlValueString;
}
-
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/DefaultProfileValidationSupportBundleStrategy.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/DefaultProfileValidationSupportBundleStrategy.java
index 3d15a742b7e..22a130a98fe 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/DefaultProfileValidationSupportBundleStrategy.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/DefaultProfileValidationSupportBundleStrategy.java
@@ -23,20 +23,16 @@ import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
-import ca.uhn.fhir.context.support.DefaultProfileValidationSupport;
-import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.parser.LenientErrorHandler;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.util.BundleUtil;
import ca.uhn.fhir.util.ClasspathUtil;
import org.apache.commons.lang3.StringUtils;
-import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IBaseBundle;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
-import javax.annotation.Nullable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -46,8 +42,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
-import java.util.Optional;
import java.util.Properties;
+import javax.annotation.Nullable;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
@@ -55,7 +51,8 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
private static final String URL_PREFIX_STRUCTURE_DEFINITION = "http://hl7.org/fhir/StructureDefinition/";
private static final String URL_PREFIX_STRUCTURE_DEFINITION_BASE = "http://hl7.org/fhir/";
- private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(DefaultProfileValidationSupport.class);
+ private static final org.slf4j.Logger ourLog =
+ org.slf4j.LoggerFactory.getLogger(DefaultProfileValidationSupport.class);
private final FhirContext myCtx;
private Map myCodeSystems;
@@ -73,7 +70,6 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
myCtx = theFhirContext;
}
-
private void initializeResourceLists() {
if (myTerminologyResources != null && myStructureDefinitionResources != null) {
@@ -90,7 +86,8 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
terminologyResources.add("/org/hl7/fhir/instance/model/valueset/v3-codesystems.xml");
Properties profileNameProperties = new Properties();
try {
- profileNameProperties.load(DefaultProfileValidationSupport.class.getResourceAsStream("/org/hl7/fhir/instance/model/profile/profiles.properties"));
+ profileNameProperties.load(DefaultProfileValidationSupport.class.getResourceAsStream(
+ "/org/hl7/fhir/instance/model/profile/profiles.properties"));
for (Object nextKey : profileNameProperties.keySet()) {
structureDefinitionResources.add("/org/hl7/fhir/instance/model/profile/" + nextKey);
}
@@ -148,7 +145,6 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
myStructureDefinitionResources = structureDefinitionResources;
}
-
@Override
public List fetchAllConformanceResources() {
ArrayList retVal = new ArrayList<>();
@@ -169,7 +165,6 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
return null;
}
-
@Override
public IBaseResource fetchCodeSystem(String theSystem) {
return fetchCodeSystemOrValueSet(theSystem, true);
@@ -208,8 +203,12 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
candidate = valueSets.get(system);
}
- if (candidate != null && isNotBlank(version) && !system.startsWith("http://hl7.org") && !system.startsWith("http://terminology.hl7.org")) {
- if (!StringUtils.equals(version, myCtx.newTerser().getSinglePrimitiveValueOrNull(candidate, "version"))) {
+ if (candidate != null
+ && isNotBlank(version)
+ && !system.startsWith("http://hl7.org")
+ && !system.startsWith("http://terminology.hl7.org")) {
+ if (!StringUtils.equals(
+ version, myCtx.newTerser().getSinglePrimitiveValueOrNull(candidate, "version"))) {
candidate = null;
}
}
@@ -239,7 +238,9 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
* search parameters eg "value.as(String)" when it should be
* "value.as(string)". This lets us be a bit lenient about this.
*/
- if (myCtx.getVersion().getVersion() == FhirVersionEnum.R4 || myCtx.getVersion().getVersion() == FhirVersionEnum.R4B || myCtx.getVersion().getVersion() == FhirVersionEnum.R5) {
+ if (myCtx.getVersion().getVersion() == FhirVersionEnum.R4
+ || myCtx.getVersion().getVersion() == FhirVersionEnum.R4B
+ || myCtx.getVersion().getVersion() == FhirVersionEnum.R5) {
String end = url.substring(URL_PREFIX_STRUCTURE_DEFINITION.length());
if (Character.isUpperCase(end.charAt(0))) {
String newEnd = Character.toLowerCase(end.charAt(0)) + end.substring(1);
@@ -251,9 +252,7 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
}
}
}
-
}
-
}
return retVal;
}
@@ -289,7 +288,8 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
return structureDefinitions;
}
- private void loadCodeSystems(Map theCodeSystems, Map theValueSets, String theClasspath) {
+ private void loadCodeSystems(
+ Map theCodeSystems, Map theValueSets, String theClasspath) {
ourLog.info("Loading CodeSystem/ValueSet from classpath: {}", theClasspath);
InputStream inputStream = DefaultProfileValidationSupport.class.getResourceAsStream(theClasspath);
InputStreamReader reader = null;
@@ -319,8 +319,8 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
switch (myCtx.getVersion().getVersion()) {
case DSTU2:
case DSTU2_HL7ORG:
-
- IPrimitiveType> codeSystem = myCtx.newTerser().getSingleValueOrNull(next, "ValueSet.codeSystem.system", IPrimitiveType.class);
+ IPrimitiveType> codeSystem = myCtx.newTerser()
+ .getSingleValueOrNull(next, "ValueSet.codeSystem.system", IPrimitiveType.class);
if (codeSystem != null && isNotBlank(codeSystem.getValueAsString())) {
theCodeSystems.put(codeSystem.getValueAsString(), next);
}
@@ -336,8 +336,6 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
break;
}
}
-
-
}
} finally {
try {
@@ -356,15 +354,14 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
// Load built-in system
if (myCtx.getVersion().getVersion().isEqualOrNewerThan(FhirVersionEnum.DSTU3)) {
- String storageCodeEnum = ClasspathUtil.loadResource("ca/uhn/fhir/context/support/HapiFhirStorageResponseCode.json");
- IBaseResource storageCodeCodeSystem = myCtx.newJsonParser().setParserErrorHandler(new LenientErrorHandler()).parseResource(storageCodeEnum);
+ String storageCodeEnum =
+ ClasspathUtil.loadResource("ca/uhn/fhir/context/support/HapiFhirStorageResponseCode.json");
+ IBaseResource storageCodeCodeSystem = myCtx.newJsonParser()
+ .setParserErrorHandler(new LenientErrorHandler())
+ .parseResource(storageCodeEnum);
String url = myCtx.newTerser().getSinglePrimitiveValueOrNull(storageCodeCodeSystem, "url");
theCodeSystems.put(url, storageCodeCodeSystem);
}
-
-
-
-
}
private void loadStructureDefinitions(Map theCodeSystems, String theClasspath) {
@@ -372,7 +369,12 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
String packageUserData = null;
if (myCtx.getVersion().getVersion().isEqualOrNewerThan(FhirVersionEnum.DSTU3)) {
- packageUserData = "hl7.fhir." + myCtx.getVersion().getVersion().name().replace("DSTU", "R").toLowerCase(Locale.US);
+ packageUserData = "hl7.fhir."
+ + myCtx.getVersion()
+ .getVersion()
+ .name()
+ .replace("DSTU", "R")
+ .toLowerCase(Locale.US);
}
try (InputStream valueSetText = DefaultProfileValidationSupport.class.getResourceAsStream(theClasspath)) {
@@ -389,7 +391,6 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
if (isNotBlank(url)) {
theCodeSystems.put(url, next);
}
-
}
// This is used by the validator to determine which package a given SD came from.
@@ -397,7 +398,6 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
if (packageUserData != null) {
next.setUserData("package", packageUserData);
}
-
}
}
} else {
@@ -426,5 +426,4 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
ArrayList retVal = new ArrayList<>(theMap.values());
return (List) Collections.unmodifiableList(retVal);
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/IValidationSupport.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/IValidationSupport.java
index c0f181ef7ed..07b383687a5 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/IValidationSupport.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/IValidationSupport.java
@@ -34,8 +34,6 @@ import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -43,6 +41,8 @@ import java.util.List;
import java.util.Set;
import java.util.function.Supplier;
import java.util.stream.Collectors;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import static org.apache.commons.lang3.StringUtils.defaultString;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
@@ -80,7 +80,6 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
public interface IValidationSupport {
String URL_PREFIX_VALUE_SET = "http://hl7.org/fhir/ValueSet/";
-
/**
* Expands the given portion of a ValueSet
*
@@ -91,7 +90,10 @@ public interface IValidationSupport {
* @return The expansion, or null
*/
@Nullable
- default ValueSetExpansionOutcome expandValueSet(ValidationSupportContext theValidationSupportContext, @Nullable ValueSetExpansionOptions theExpansionOptions, @Nonnull IBaseResource theValueSetToExpand) {
+ default ValueSetExpansionOutcome expandValueSet(
+ ValidationSupportContext theValidationSupportContext,
+ @Nullable ValueSetExpansionOptions theExpansionOptions,
+ @Nonnull IBaseResource theValueSetToExpand) {
return null;
}
@@ -107,11 +109,16 @@ public interface IValidationSupport {
* @since 6.0.0
*/
@Nullable
- default ValueSetExpansionOutcome expandValueSet(ValidationSupportContext theValidationSupportContext, @Nullable ValueSetExpansionOptions theExpansionOptions, @Nonnull String theValueSetUrlToExpand) throws ResourceNotFoundException {
+ default ValueSetExpansionOutcome expandValueSet(
+ ValidationSupportContext theValidationSupportContext,
+ @Nullable ValueSetExpansionOptions theExpansionOptions,
+ @Nonnull String theValueSetUrlToExpand)
+ throws ResourceNotFoundException {
Validate.notBlank(theValueSetUrlToExpand, "theValueSetUrlToExpand must not be null or blank");
IBaseResource valueSet = fetchValueSet(theValueSetUrlToExpand);
if (valueSet == null) {
- throw new ResourceNotFoundException(Msg.code(2024) + "Unknown ValueSet: " + UrlUtil.escapeUrlParam(theValueSetUrlToExpand));
+ throw new ResourceNotFoundException(
+ Msg.code(2024) + "Unknown ValueSet: " + UrlUtil.escapeUrlParam(theValueSetUrlToExpand));
}
return expandValueSet(theValidationSupportContext, theExpansionOptions, valueSet);
}
@@ -200,17 +207,14 @@ public interface IValidationSupport {
Validate.notBlank(theUri, "theUri must not be null or blank");
if (theClass == null) {
- Supplier[] sources = new Supplier[]{
- () -> fetchStructureDefinition(theUri),
- () -> fetchValueSet(theUri),
- () -> fetchCodeSystem(theUri)
+ Supplier[] sources = new Supplier[] {
+ () -> fetchStructureDefinition(theUri), () -> fetchValueSet(theUri), () -> fetchCodeSystem(theUri)
};
- return (T) Arrays
- .stream(sources)
- .map(t -> t.get())
- .filter(t -> t != null)
- .findFirst()
- .orElse(null);
+ return (T) Arrays.stream(sources)
+ .map(t -> t.get())
+ .filter(t -> t != null)
+ .findFirst()
+ .orElse(null);
}
switch (getFhirContext().getResourceType(theClass)) {
@@ -289,7 +293,13 @@ public interface IValidationSupport {
* @return Returns a validation result object
*/
@Nullable
- default CodeValidationResult validateCode(@Nonnull ValidationSupportContext theValidationSupportContext, @Nonnull ConceptValidationOptions theOptions, String theCodeSystem, String theCode, String theDisplay, String theValueSetUrl) {
+ default CodeValidationResult validateCode(
+ @Nonnull ValidationSupportContext theValidationSupportContext,
+ @Nonnull ConceptValidationOptions theOptions,
+ String theCodeSystem,
+ String theCode,
+ String theDisplay,
+ String theValueSetUrl) {
return null;
}
@@ -307,7 +317,13 @@ public interface IValidationSupport {
* @return Returns a validation result object, or null if this validation support module can not handle this kind of request
*/
@Nullable
- default CodeValidationResult validateCodeInValueSet(ValidationSupportContext theValidationSupportContext, ConceptValidationOptions theOptions, String theCodeSystem, String theCode, String theDisplay, @Nonnull IBaseResource theValueSet) {
+ default CodeValidationResult validateCodeInValueSet(
+ ValidationSupportContext theValidationSupportContext,
+ ConceptValidationOptions theOptions,
+ String theCodeSystem,
+ String theCode,
+ String theDisplay,
+ @Nonnull IBaseResource theValueSet) {
return null;
}
@@ -321,7 +337,11 @@ public interface IValidationSupport {
* @param theDisplayLanguage to filter out the designation by the display language. To return all designation, set this value to null.
*/
@Nullable
- default LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode, String theDisplayLanguage) {
+ default LookupCodeResult lookupCode(
+ ValidationSupportContext theValidationSupportContext,
+ String theSystem,
+ String theCode,
+ String theDisplayLanguage) {
return null;
}
@@ -334,7 +354,8 @@ public interface IValidationSupport {
* @param theCode The code
*/
@Nullable
- default LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode) {
+ default LookupCodeResult lookupCode(
+ ValidationSupportContext theValidationSupportContext, String theSystem, String theCode) {
return lookupCode(theValidationSupportContext, theSystem, theCode, null);
}
@@ -358,7 +379,12 @@ public interface IValidationSupport {
* @return Returns null if this module does not know how to handle this request
*/
@Nullable
- default IBaseResource generateSnapshot(ValidationSupportContext theValidationSupportContext, IBaseResource theInput, String theUrl, String theWebUrl, String theProfileName) {
+ default IBaseResource generateSnapshot(
+ ValidationSupportContext theValidationSupportContext,
+ IBaseResource theInput,
+ String theUrl,
+ String theWebUrl,
+ String theProfileName) {
return null;
}
@@ -755,11 +781,13 @@ public interface IValidationSupport {
public void throwNotFoundIfAppropriate() {
if (isFound() == false) {
- throw new ResourceNotFoundException(Msg.code(1738) + "Unable to find code[" + getSearchedForCode() + "] in system[" + getSearchedForSystem() + "]");
+ throw new ResourceNotFoundException(Msg.code(1738) + "Unable to find code[" + getSearchedForCode()
+ + "] in system[" + getSearchedForSystem() + "]");
}
}
- public IBaseParameters toParameters(FhirContext theContext, List extends IPrimitiveType> theProperties) {
+ public IBaseParameters toParameters(
+ FhirContext theContext, List extends IPrimitiveType> theProperties) {
IBaseParameters retVal = ParametersUtil.newInstance(theContext);
if (isNotBlank(getCodeSystemDisplayName())) {
@@ -775,10 +803,9 @@ public interface IValidationSupport {
Set properties = Collections.emptySet();
if (theProperties != null) {
- properties = theProperties
- .stream()
- .map(IPrimitiveType::getValueAsString)
- .collect(Collectors.toSet());
+ properties = theProperties.stream()
+ .map(IPrimitiveType::getValueAsString)
+ .collect(Collectors.toSet());
}
for (IValidationSupport.BaseConceptProperty next : myProperties) {
@@ -797,7 +824,8 @@ public interface IValidationSupport {
ParametersUtil.addPartString(theContext, property, "value", prop.getValue());
} else if (next instanceof IValidationSupport.CodingConceptProperty) {
IValidationSupport.CodingConceptProperty prop = (IValidationSupport.CodingConceptProperty) next;
- ParametersUtil.addPartCoding(theContext, property, "value", prop.getCodeSystem(), prop.getCode(), prop.getDisplay());
+ ParametersUtil.addPartCoding(
+ theContext, property, "value", prop.getCodeSystem(), prop.getCode(), prop.getDisplay());
} else {
throw new IllegalStateException(Msg.code(1739) + "Don't know how to handle " + next.getClass());
}
@@ -809,7 +837,8 @@ public interface IValidationSupport {
IBase property = ParametersUtil.addParameterToParameters(theContext, retVal, "designation");
ParametersUtil.addPartCode(theContext, property, "language", next.getLanguage());
- ParametersUtil.addPartCoding(theContext, property, "use", next.getUseSystem(), next.getUseCode(), next.getUseDisplay());
+ ParametersUtil.addPartCoding(
+ theContext, property, "use", next.getUseSystem(), next.getUseCode(), next.getUseDisplay());
ParametersUtil.addPartString(theContext, property, "value", next.getValue());
}
}
@@ -819,13 +848,12 @@ public interface IValidationSupport {
public static LookupCodeResult notFound(String theSearchedForSystem, String theSearchedForCode) {
return new LookupCodeResult()
- .setFound(false)
- .setSearchedForSystem(theSearchedForSystem)
- .setSearchedForCode(theSearchedForCode);
+ .setFound(false)
+ .setSearchedForSystem(theSearchedForSystem)
+ .setSearchedForCode(theSearchedForCode);
}
}
-
class TranslateCodeRequest {
private final String myTargetSystemUrl;
private final String myConceptMapUrl;
@@ -848,14 +876,14 @@ public interface IValidationSupport {
}
public TranslateCodeRequest(
- List theCodings,
- String theTargetSystemUrl,
- String theConceptMapUrl,
- String theConceptMapVersion,
- String theSourceValueSetUrl,
- String theTargetValueSetUrl,
- IIdType theResourceId,
- boolean theReverse) {
+ List theCodings,
+ String theTargetSystemUrl,
+ String theConceptMapUrl,
+ String theConceptMapVersion,
+ String theSourceValueSetUrl,
+ String theTargetValueSetUrl,
+ IIdType theResourceId,
+ boolean theReverse) {
myCodings = theCodings;
myTargetSystemUrl = theTargetSystemUrl;
myConceptMapUrl = theConceptMapUrl;
@@ -879,29 +907,29 @@ public interface IValidationSupport {
TranslateCodeRequest that = (TranslateCodeRequest) theO;
return new EqualsBuilder()
- .append(myCodings, that.myCodings)
- .append(myTargetSystemUrl, that.myTargetSystemUrl)
- .append(myConceptMapUrl, that.myConceptMapUrl)
- .append(myConceptMapVersion, that.myConceptMapVersion)
- .append(mySourceValueSetUrl, that.mySourceValueSetUrl)
- .append(myTargetValueSetUrl, that.myTargetValueSetUrl)
- .append(myResourceId, that.myResourceId)
- .append(myReverse, that.myReverse)
- .isEquals();
+ .append(myCodings, that.myCodings)
+ .append(myTargetSystemUrl, that.myTargetSystemUrl)
+ .append(myConceptMapUrl, that.myConceptMapUrl)
+ .append(myConceptMapVersion, that.myConceptMapVersion)
+ .append(mySourceValueSetUrl, that.mySourceValueSetUrl)
+ .append(myTargetValueSetUrl, that.myTargetValueSetUrl)
+ .append(myResourceId, that.myResourceId)
+ .append(myReverse, that.myReverse)
+ .isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
- .append(myCodings)
- .append(myTargetSystemUrl)
- .append(myConceptMapUrl)
- .append(myConceptMapVersion)
- .append(mySourceValueSetUrl)
- .append(myTargetValueSetUrl)
- .append(myResourceId)
- .append(myReverse)
- .toHashCode();
+ .append(myCodings)
+ .append(myTargetSystemUrl)
+ .append(myConceptMapUrl)
+ .append(myConceptMapVersion)
+ .append(mySourceValueSetUrl)
+ .append(myTargetValueSetUrl)
+ .append(myResourceId)
+ .append(myReverse)
+ .toHashCode();
}
public List getCodings() {
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/TranslateConceptResult.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/TranslateConceptResult.java
index 54aae576eda..6ec2631dfed 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/TranslateConceptResult.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/TranslateConceptResult.java
@@ -52,14 +52,14 @@ public class TranslateConceptResult {
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
- .append("system", mySystem)
- .append("code", myCode)
- .append("display", myDisplay)
- .append("equivalence", myEquivalence)
- .append("conceptMapUrl", myConceptMapUrl)
- .append("valueSet", myValueSet)
- .append("systemVersion", mySystemVersion)
- .toString();
+ .append("system", mySystem)
+ .append("code", myCode)
+ .append("display", myDisplay)
+ .append("equivalence", myEquivalence)
+ .append("conceptMapUrl", myConceptMapUrl)
+ .append("valueSet", myValueSet)
+ .append("systemVersion", mySystemVersion)
+ .toString();
}
public String getCode() {
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/ValueSetExpansionOptions.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/ValueSetExpansionOptions.java
index c0bd0cb04c8..5c2c0fdd57b 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/ValueSetExpansionOptions.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/ValueSetExpansionOptions.java
@@ -115,9 +115,7 @@ public class ValueSetExpansionOptions {
}
public static ValueSetExpansionOptions forOffsetAndCount(int theOffset, int theCount) {
- return new ValueSetExpansionOptions()
- .setOffset(theOffset)
- .setCount(theCount);
+ return new ValueSetExpansionOptions().setOffset(theOffset).setCount(theCount);
}
public String getTheDisplayLanguage() {
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/fhirpath/FhirPathExecutionException.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/fhirpath/FhirPathExecutionException.java
index ffdbb1334ba..65d2a889333 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/fhirpath/FhirPathExecutionException.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/fhirpath/FhirPathExecutionException.java
@@ -36,5 +36,4 @@ public class FhirPathExecutionException extends InternalErrorException {
public FhirPathExecutionException(String theMessage) {
super(theMessage);
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/fhirpath/IFhirPath.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/fhirpath/IFhirPath.java
index f3f5dfe64bc..59d3920b1cc 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/fhirpath/IFhirPath.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/fhirpath/IFhirPath.java
@@ -21,16 +21,16 @@ package ca.uhn.fhir.fhirpath;
import org.hl7.fhir.instance.model.api.IBase;
-import javax.annotation.Nonnull;
import java.util.List;
import java.util.Optional;
+import javax.annotation.Nonnull;
public interface IFhirPath {
/**
* Apply the given FhirPath expression against the given input and return
* all results in a list
- *
+ *
* @param theInput The input object (generally a resource or datatype)
* @param thePath The fluent path expression
* @param theReturnType The type to return (in order to avoid casting)
@@ -47,13 +47,11 @@ public interface IFhirPath {
*/
Optional evaluateFirst(IBase theInput, String thePath, Class theReturnType);
-
/**
* Parses the expression and throws an exception if it can not parse correctly
*/
void parse(String theExpression) throws Exception;
-
/**
* This method can be used optionally to supply an evaluation context for the
* FHIRPath evaluator instance. The context can be used to supply data needed by
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/HapiErrorCode.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/HapiErrorCode.java
index ba58777a4bb..c09fba15b6d 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/HapiErrorCode.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/HapiErrorCode.java
@@ -19,7 +19,4 @@
*/
package ca.uhn.fhir.i18n;
-public final class HapiErrorCode {
-
-}
-
+public final class HapiErrorCode {}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/HapiLocalizer.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/HapiLocalizer.java
index f3e39d32298..b94dde62821 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/HapiLocalizer.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/HapiLocalizer.java
@@ -39,8 +39,6 @@ import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import static org.apache.commons.lang3.StringUtils.trim;
-
-
/**
* This feature is not yet in its final state and should be considered an internal part of HAPI for now - use with caution
*/
@@ -48,6 +46,7 @@ public class HapiLocalizer {
@SuppressWarnings("WeakerAccess")
public static final String UNKNOWN_I18N_KEY_MESSAGE = "!MESSAGE!";
+
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(HapiLocalizer.class);
private static boolean ourFailOnMissingMessage;
private final Map myKeyToMessageFormat = new ConcurrentHashMap<>();
@@ -148,19 +147,18 @@ public class HapiLocalizer {
MessageFormat newMessageFormat(String theFormatString) {
StringBuilder pattern = new StringBuilder(theFormatString.trim());
-
- for (int i = 0; i < (pattern.length()-1); i++) {
+ for (int i = 0; i < (pattern.length() - 1); i++) {
if (pattern.charAt(i) == '{') {
- char nextChar = pattern.charAt(i+1);
+ char nextChar = pattern.charAt(i + 1);
if (nextChar >= '0' && nextChar <= '9') {
continue;
}
- pattern.replace(i, i+1, "'{'");
+ pattern.replace(i, i + 1, "'{'");
int closeBraceIndex = pattern.indexOf("}", i);
if (closeBraceIndex > 0) {
i = closeBraceIndex;
- pattern.replace(i, i+1, "'}'");
+ pattern.replace(i, i + 1, "'}'");
}
}
}
@@ -175,11 +173,11 @@ public class HapiLocalizer {
}
}
- public Locale getLocale() {
+ public Locale getLocale() {
return myLocale;
- }
+ }
- /**
+ /**
* This global setting causes the localizer to fail if any attempts
* are made to retrieve a key that does not exist. This method is primarily for
* unit tests.
@@ -191,5 +189,4 @@ public class HapiLocalizer {
public static String toKey(Class> theType, String theKey) {
return theType.getName() + '.' + theKey;
}
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/Msg.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/Msg.java
index e5d22645b0f..4e8bc672a78 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/Msg.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/Msg.java
@@ -26,7 +26,6 @@ public final class Msg {
* IMPORTANT: Please update the table in the following link after you add a new code:
* https://github.com/hapifhir/hapi-fhir/wiki/Bumping-Error-Code
*/
-
private Msg() {}
public static String code(int theCode) {
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/Hook.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/Hook.java
index d0f611b155e..a7974dd0c22 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/Hook.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/Hook.java
@@ -20,7 +20,6 @@
package ca.uhn.fhir.interceptor.api;
import java.lang.annotation.ElementType;
-import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/HookParams.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/HookParams.java
index 48df3e72343..f9f96ccb4c1 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/HookParams.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/HookParams.java
@@ -24,12 +24,12 @@ import com.google.common.collect.ListMultimap;
import com.google.common.collect.Multimaps;
import org.apache.commons.lang3.Validate;
-import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.function.Supplier;
import java.util.stream.Collectors;
+import javax.annotation.Nonnull;
public class HookParams {
@@ -38,8 +38,7 @@ public class HookParams {
/**
* Constructor
*/
- public HookParams() {
- }
+ public HookParams() {}
/**
* Constructor
@@ -61,13 +60,13 @@ public class HookParams {
return doAdd(theType, theParam);
}
-// /**
-// * This is useful for providing a lazy-loaded (generally expensive to create)
-// * parameters
-// */
-// public HookParams addSupplier(Class theType, Supplier theParam) {
-// return doAdd(theType, theParam);
-// }
+ // /**
+ // * This is useful for providing a lazy-loaded (generally expensive to create)
+ // * parameters
+ // */
+ // public HookParams addSupplier(Class theType, Supplier theParam) {
+ // return doAdd(theType, theParam);
+ // }
private HookParams doAdd(Class theType, Object theParam) {
Validate.isTrue(theType.equals(Supplier.class) == false, "Can not add parameters of type Supplier");
@@ -110,9 +109,7 @@ public class HookParams {
}
public Collection