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 a78dd07fe9e..9541129537c 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 @@ -20,7 +20,7 @@ package ca.uhn.fhir.context; * #L% */ -import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.*; import java.io.IOException; import java.io.InputStream; @@ -55,7 +55,6 @@ import ca.uhn.fhir.model.api.IResourceBlock; import ca.uhn.fhir.model.api.IValueSetEnumBinder; import ca.uhn.fhir.model.api.annotation.Block; import ca.uhn.fhir.model.api.annotation.Child; -import ca.uhn.fhir.model.api.annotation.CodeTableDef; import ca.uhn.fhir.model.api.annotation.DatatypeDef; import ca.uhn.fhir.model.api.annotation.Description; import ca.uhn.fhir.model.api.annotation.Extension; @@ -257,16 +256,6 @@ class ModelScanner { } } - CodeTableDef codeTableDefinition = theClass.getAnnotation(CodeTableDef.class); - if (codeTableDefinition != null) { - if (ICodeEnum.class.isAssignableFrom(theClass)) { - @SuppressWarnings("unchecked") - Class extends ICodeEnum> resClass = (Class extends ICodeEnum>) theClass; - scanCodeTable(resClass, codeTableDefinition); - } else { - throw new ConfigurationException("Type contains a @" + CodeTableDef.class.getSimpleName() + " annotation but does not implement " + ICodeEnum.class.getCanonicalName() + ": " + theClass.getCanonicalName()); - } - } Block blockDefinition = theClass.getAnnotation(Block.class); if (blockDefinition != null) { @@ -279,7 +268,7 @@ class ModelScanner { } } - if (blockDefinition == null && codeTableDefinition == null && datatypeDefinition == null && resourceDefinition == null) { + if (blockDefinition == null && datatypeDefinition == null && resourceDefinition == null) { throw new ConfigurationException("Resource type does not contain any valid HAPI-FHIR annotations: " + theClass.getCanonicalName()); } } @@ -287,8 +276,7 @@ class ModelScanner { private void scanBlock(Class extends IResourceBlock> theClass, Block theBlockDefinition) { ourLog.debug("Scanning resource block class: {}", theClass.getName()); - String resourceName = theBlockDefinition.name(); // TODO: remove name - resourceName = theClass.getCanonicalName(); + String resourceName = theClass.getCanonicalName(); if (isBlank(resourceName)) { throw new ConfigurationException("Block type @" + Block.class.getSimpleName() + " annotation contains no name: " + theClass.getCanonicalName()); } @@ -299,9 +287,6 @@ class ModelScanner { scanCompositeElementForChildren(theClass, resourceDef); } - private String scanCodeTable(Class extends ICodeEnum> theCodeType, CodeTableDef theCodeTableDefinition) { - return null; // TODO: implement - } private void scanCompositeDatatype(Class extends ICompositeDatatype> theClass, DatatypeDef theDatatypeDefinition) { ourLog.debug("Scanning resource class: {}", theClass.getName()); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Block.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Block.java index c36fe57efa6..76dcbc7714d 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Block.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Block.java @@ -25,6 +25,14 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +/** + * Class annotation used to indicate a class which is a "block"/"component" type. A block + * is a nested group of fields within a resource definition and can contain other blocks as + * well as data types. + *
+ * An example of a block would be Patient.contact + *
+ */ @Retention(RetentionPolicy.RUNTIME) @Target(value= {ElementType.TYPE}) public @interface Block { diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Child.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Child.java index 4bfbeda865e..ed283831550 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Child.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Child.java @@ -27,6 +27,10 @@ import java.lang.annotation.Target; import ca.uhn.fhir.model.api.IElement; +/** + * Field annotation for fields within resource and datatype definitions, indicating + * a child of that type. + */ @Retention(RetentionPolicy.RUNTIME) @Target(value= {ElementType.FIELD}) public @interface Child { @@ -42,14 +46,37 @@ public @interface Child { */ int MAX_UNLIMITED = -1; + /** + * The name of this field, as it will appear in serialized versions of the message + */ String name(); + /** + * The order in which this field comes within its parent. The first field should have a + * value of 0, the second a value of 1, etc. + */ int order() default ORDER_UNKNOWN; + /** + * The minimum number of repetitions allowed for this child + */ int min() default 0; + /** + * The maximum number of repetitions allowed for this child. Should be + * set to {@link #MAX_UNLIMITED} if there is no limit to the number of + * repetitions. + */ int max() default 1; + /** + * Lists the allowable types for this field, if the field supports multiple + * types (otherwise does not need to be populated). + *+ * For example, if this field supports either DateTimeDt or BooleanDt types, + * those two classes should be supplied here. + *
+ */ Class extends IElement>[] type() default {}; // Not implemented diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Choice.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Choice.java deleted file mode 100644 index 6784472453a..00000000000 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Choice.java +++ /dev/null @@ -1,36 +0,0 @@ -package ca.uhn.fhir.model.api.annotation; - -/* - * #%L - * HAPI FHIR - Core Library - * %% - * Copyright (C) 2014 University Health Network - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import ca.uhn.fhir.model.api.IElement; - -@Retention(RetentionPolicy.RUNTIME) -@Target(value= {ElementType.FIELD}) -public @interface Choice { - - Class extends IElement>[] types() default {}; - -} diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/CodeTableDef.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/CodeTableDef.java deleted file mode 100644 index dbbb930ccbb..00000000000 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/CodeTableDef.java +++ /dev/null @@ -1,40 +0,0 @@ -package ca.uhn.fhir.model.api.annotation; - -/* - * #%L - * HAPI FHIR - Core Library - * %% - * Copyright (C) 2014 University Health Network - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(value= {ElementType.TYPE}) -public @interface CodeTableDef { - - int tableId(); - - String name(); - - int[] restrictedToSnomedIsA() default {}; - - - -} diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Constraint.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Constraint.java deleted file mode 100644 index b5868d2c1c6..00000000000 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Constraint.java +++ /dev/null @@ -1,37 +0,0 @@ -package ca.uhn.fhir.model.api.annotation; - -/* - * #%L - * HAPI FHIR - Core Library - * %% - * Copyright (C) 2014 University Health Network - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(value= {ElementType.FIELD}) -public @interface Constraint { - - String[] coRequirements() default {}; - - String[] lessThan() default {}; - - String[] greaterThan() default {}; -} diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/DatatypeDef.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/DatatypeDef.java index 31ee559f416..e119e90988a 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/DatatypeDef.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/DatatypeDef.java @@ -28,6 +28,9 @@ import java.lang.annotation.Target; import ca.uhn.fhir.model.primitive.BoundCodeDt; import ca.uhn.fhir.model.primitive.CodeDt; +/** + * Class annotation to note a class which defines a datatype + */ @Retention(RetentionPolicy.RUNTIME) @Target(value= {ElementType.TYPE}) public @interface DatatypeDef { diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Description.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Description.java index 766dc8c9ac9..b173a39b4ae 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Description.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Description.java @@ -25,6 +25,10 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +/** + * Annotation which may be placed on a resource/datatype definition, or a field, or + * a search parameter definition in order to provide documentation for that item. + */ @Retention(RetentionPolicy.RUNTIME) @Target(value= {ElementType.FIELD, ElementType.TYPE, ElementType.PARAMETER, ElementType.METHOD}) public @interface Description { diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/EnumeratedCodeValue.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/EnumeratedCodeValue.java deleted file mode 100644 index 7752f91df32..00000000000 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/EnumeratedCodeValue.java +++ /dev/null @@ -1,35 +0,0 @@ -package ca.uhn.fhir.model.api.annotation; - -/* - * #%L - * HAPI FHIR - Core Library - * %% - * Copyright (C) 2014 University Health Network - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(value= {ElementType.FIELD}) -public @interface EnumeratedCodeValue { - - String value(); - - String system() default ""; -} diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Extension.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Extension.java index de22a20331d..062abf5c97d 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Extension.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Extension.java @@ -25,36 +25,41 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +/** + * Field modifier to be placed on a child field (a field also annotated with the {@link Child} annotation) which + * indicates that this field is an extension. + */ @Target(value = { ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) public @interface Extension { /** - * This parameter affects how the extension is treated when the element - * definition containing this resource is exported to a profile. + * This parameter affects how the extension is treated when the element definition containing this resource is + * exported to a profile. * *
- * If set to true
, the resource is taken to be a local
- * resource and its definition is exported along with the reference. Use
- * this option for extension defintions that you have added locally (i.e.
- * within your own organization)
+ * If set to true
, the resource is taken to be a local resource and its definition is exported
+ * along with the reference. Use this option for extension defintions that you have added locally (i.e. within your
+ * own organization)
*
- * If set to false
, the resource is taken to be a remote
- * resource and its definition is not exported to the profile. Use
- * this option for extensions that are defined by other organizations (i.e.
+ * If set to false
, the resource is taken to be a remote resource and its definition is
+ * not exported to the profile. Use this option for extensions that are defined by other organizations (i.e.
* by regional authorities or jurisdictional governments)
*
true
if this extension is a
- * modifier extension
+ * Returns true
if this extension is a modifier extension
*/
boolean isModifier();
-
+
+ /**
+ * The URL associated with this extension
+ */
String url();
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/IsIdentifier.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/IsIdentifier.java
deleted file mode 100644
index 42634b9a70c..00000000000
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/IsIdentifier.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package ca.uhn.fhir.model.api.annotation;
-
-/*
- * #%L
- * HAPI FHIR - Core Library
- * %%
- * Copyright (C) 2014 University Health Network
- * %%
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * #L%
- */
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target(value= {ElementType.FIELD})
-public @interface IsIdentifier {
-
- // nothing
-
-}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/ResourceDef.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/ResourceDef.java
index c08d7be3101..6d9668de911 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/ResourceDef.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/ResourceDef.java
@@ -25,6 +25,9 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+/**
+ * Class annotation which indicates a resource definition class
+ */
@Retention(RetentionPolicy.RUNTIME)
@Target(value= {ElementType.TYPE})
public @interface ResourceDef {
@@ -34,8 +37,14 @@ public @interface ResourceDef {
*/
String name();
+ /**
+ * Not currently used
+ */
String id() default "";
+ /**
+ * The URL indicating the profile for this resource definition, if known
+ */
String profile() default "";
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/SearchParamDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/SearchParamDefinition.java
index 0b06da340fd..1407b4391fc 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/SearchParamDefinition.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/SearchParamDefinition.java
@@ -29,12 +29,24 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
public @interface SearchParamDefinition {
+ /**
+ * The name for this parameter
+ */
String name();
+ /**
+ * The path for this parameter
+ */
String path();
+ /**
+ * A description of this parameter
+ */
String description() default "";
+ /**
+ * The type for this parameter, e.g. "string", or "token"
+ */
String type() default "string";
/**
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/SimpleSetter.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/SimpleSetter.java
index 1355e90dd5d..732d98e5eb8 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/SimpleSetter.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/SimpleSetter.java
@@ -27,7 +27,10 @@ import java.lang.annotation.Target;
/**
* Marker annotation for a primitive setter method that can be used to
- * indicate a "simple setter" method on a resource or composite type
+ * indicate a "simple setter" method on a resource or composite type.
+ *
+ * This annotation is used by HAPI's code generator and can be ignored by
+ * client code
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(value= {ElementType.CONSTRUCTOR})
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BaseDateTimeDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BaseDateTimeDt.java
index 3be99fc3451..52879b03b1d 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BaseDateTimeDt.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BaseDateTimeDt.java
@@ -115,7 +115,7 @@ public abstract class BaseDateTimeDt extends BasePrimitiveIdentifier | URNo |
Address | 99 Houston Road BENTLEIGH Victoria |
Date of birth | 01 January 1997 |