Skip to content

Commit 0c2d162

Browse files
committed
Remove unecessary complexity in db utils Table/ColumnDefBuilder
I added the original if logic because it was throwing a NullPointer and I didn't understand why...now I realize it was just from "auto-boxing" of the Integer to an int. Now I switched the parameter to type Integer so we can remove the extra branching logic. Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
1 parent 7268d15 commit 0c2d162

3 files changed

Lines changed: 3 additions & 11 deletions

File tree

fhir-database-utils/src/main/java/com/ibm/fhir/database/utils/model/ColumnDefBuilder.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,7 @@ protected List<ColumnBase> buildColumns() {
156156
column = new DoubleColumn(cd.getName(), cd.isNullable());
157157
break;
158158
case TIMESTAMP:
159-
if (cd.getPrecision() == null) {
160-
column = new TimestampColumn(cd.getName(), cd.isNullable());
161-
} else {
162-
column = new TimestampColumn(cd.getName(), cd.isNullable(), cd.getPrecision());
163-
}
159+
column = new TimestampColumn(cd.getName(), cd.isNullable(), cd.getPrecision());
164160
break;
165161
case VARCHAR:
166162
if (cd.getSize() > Integer.MAX_VALUE) {

fhir-database-utils/src/main/java/com/ibm/fhir/database/utils/model/Table.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -532,11 +532,7 @@ protected List<ColumnBase> buildColumns() {
532532
column = new DoubleColumn(cd.getName(), cd.isNullable());
533533
break;
534534
case TIMESTAMP:
535-
if (cd.getPrecision() == null) {
536-
column = new TimestampColumn(cd.getName(), cd.isNullable());
537-
} else {
538-
column = new TimestampColumn(cd.getName(), cd.isNullable(), cd.getPrecision());
539-
}
535+
column = new TimestampColumn(cd.getName(), cd.isNullable(), cd.getPrecision());
540536
break;
541537
case VARCHAR:
542538
if (cd.getSize() > Integer.MAX_VALUE) {

fhir-database-utils/src/main/java/com/ibm/fhir/database/utils/model/TimestampColumn.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public TimestampColumn(String name, boolean nullable) {
2222
this.precision = null;
2323
}
2424

25-
public TimestampColumn(String name, boolean nullable, int precision) {
25+
public TimestampColumn(String name, boolean nullable, Integer precision) {
2626
super(name, nullable);
2727
this.precision = precision;
2828
}

0 commit comments

Comments
 (0)