diff options
Diffstat (limited to 'gson/src/main/java/org/onap/policy/common/gson/DoubleConverter.java')
-rw-r--r-- | gson/src/main/java/org/onap/policy/common/gson/DoubleConverter.java | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/gson/src/main/java/org/onap/policy/common/gson/DoubleConverter.java b/gson/src/main/java/org/onap/policy/common/gson/DoubleConverter.java index 81803ff2..4d10bd13 100644 --- a/gson/src/main/java/org/onap/policy/common/gson/DoubleConverter.java +++ b/gson/src/main/java/org/onap/policy/common/gson/DoubleConverter.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,18 +25,17 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; /** * Converter for Double values. By default, GSON treats all Objects that are numbers, as * Double. This converts Doubles to Integer or Long, if possible. It converts stand-alone * Doubles, as well as those found within Arrays and Maps. */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) public class DoubleConverter { - private DoubleConverter() { - // do nothing - } - /** * Performs in-place conversion of all values in a list. * @@ -98,7 +97,7 @@ public class DoubleConverter { } Double num = (Double) value; - long longval = num.longValue(); + var longval = num.longValue(); if (Double.compare(num.doubleValue(), longval) != 0) { // it isn't integral - return unchanged value @@ -106,7 +105,7 @@ public class DoubleConverter { } // it's integral - determine if it's an integer or a long - int intval = (int) longval; + var intval = (int) longval; if (intval == longval) { return intval; |