From 56b0acf73facefeff4f180ba0b161e3fcab0ff14 Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Mon, 11 May 2020 09:01:31 -0400 Subject: [PATCH] A bit of datatype cleanup --- .../main/java/org/hl7/fhir/r5/model/Integer64Type.java | 8 ++------ .../main/java/org/hl7/fhir/r5/model/IntegerType.java | 10 +++++----- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Integer64Type.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Integer64Type.java index 1c6be9c93..96aec817b 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Integer64Type.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Integer64Type.java @@ -55,7 +55,7 @@ package org.hl7.fhir.r5.model; 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") public class Integer64Type extends PrimitiveType /* implements IBaseInteger64Datatype */ { @@ -95,12 +95,8 @@ public class Integer64Type extends PrimitiveType /* implements IBaseIntege * @throws IllegalArgumentException If the value is too large to fit in a signed integer */ 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) { - setValue((long)theValue.longValue()); + setValue(theValue); } } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/IntegerType.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/IntegerType.java index 102eec1f3..830f22f05 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/IntegerType.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/IntegerType.java @@ -97,12 +97,12 @@ public class IntegerType extends PrimitiveType implements IBaseIntegerD * @throws IllegalArgumentException If the value is too large to fit in a signed integer */ public IntegerType(Long theValue) { - if (theValue < java.lang.Integer.MIN_VALUE || theValue > java.lang.Integer.MAX_VALUE) { - throw new IllegalArgumentException - (theValue + " cannot be cast to int without changing its value."); - } if(theValue!=null) { - setValue((int)theValue.longValue()); + if (theValue < java.lang.Integer.MIN_VALUE || theValue > java.lang.Integer.MAX_VALUE) { + throw new IllegalArgumentException + (theValue + " cannot be cast to int without changing its value."); + } + setValue(theValue.intValue()); } }