A bit of datatype cleanup

This commit is contained in:
jamesagnew 2020-05-11 09:01:31 -04:00
parent 7c81ebce56
commit 56b0acf73f
2 changed files with 7 additions and 11 deletions

View File

@ -55,7 +55,7 @@ package org.hl7.fhir.r5.model;
import ca.uhn.fhir.model.api.annotation.DatatypeDef; import ca.uhn.fhir.model.api.annotation.DatatypeDef;
/** /**
* Primitive type "integer" in FHIR: A signed 32-bit integer * Primitive type "integer" in FHIR: A signed 64-bit integer
*/ */
@DatatypeDef(name = "integer64") @DatatypeDef(name = "integer64")
public class Integer64Type extends PrimitiveType<Long> /* implements IBaseInteger64Datatype */ { public class Integer64Type extends PrimitiveType<Long> /* implements IBaseInteger64Datatype */ {
@ -95,12 +95,8 @@ public class Integer64Type extends PrimitiveType<Long> /* implements IBaseIntege
* @throws IllegalArgumentException If the value is too large to fit in a signed integer * @throws IllegalArgumentException If the value is too large to fit in a signed integer
*/ */
public Integer64Type(Long theValue) { public Integer64Type(Long theValue) {
if (theValue < java.lang.Long.MIN_VALUE || theValue > java.lang.Long.MAX_VALUE) {
throw new IllegalArgumentException
(theValue + " cannot be cast to int without changing its value.");
}
if(theValue!=null) { if(theValue!=null) {
setValue((long)theValue.longValue()); setValue(theValue);
} }
} }

View File

@ -97,12 +97,12 @@ public class IntegerType extends PrimitiveType<Integer> implements IBaseIntegerD
* @throws IllegalArgumentException If the value is too large to fit in a signed integer * @throws IllegalArgumentException If the value is too large to fit in a signed integer
*/ */
public IntegerType(Long theValue) { public IntegerType(Long theValue) {
if(theValue!=null) {
if (theValue < java.lang.Integer.MIN_VALUE || theValue > java.lang.Integer.MAX_VALUE) { if (theValue < java.lang.Integer.MIN_VALUE || theValue > java.lang.Integer.MAX_VALUE) {
throw new IllegalArgumentException throw new IllegalArgumentException
(theValue + " cannot be cast to int without changing its value."); (theValue + " cannot be cast to int without changing its value.");
} }
if(theValue!=null) { setValue(theValue.intValue());
setValue((int)theValue.longValue());
} }
} }