diff options
author | 2021-01-29 12:05:05 +0000 | |
---|---|---|
committer | 2021-01-29 12:05:05 +0000 | |
commit | 123b423cddbe01bdaba0bea50d986ff1b18a25bc (patch) | |
tree | 8495f849914eecc639e50ff7a2cd5dbd44da78bc /sdnr/wt/data-provider/model/src/main/java/org/opendaylight | |
parent | 6e45a54cf77e2473cc441ba587483eedff838dd8 (diff) | |
parent | a3e70a1a48d13193d9f28a2d91089d5b253d3e91 (diff) |
Merge "update common and data-provider"
Diffstat (limited to 'sdnr/wt/data-provider/model/src/main/java/org/opendaylight')
-rw-r--r-- | sdnr/wt/data-provider/model/src/main/java/org/opendaylight/yang/gen/v1/http/org/openroadm/pm/types/rev191129/PmDataTypeBuilder.java | 53 |
1 files changed, 13 insertions, 40 deletions
diff --git a/sdnr/wt/data-provider/model/src/main/java/org/opendaylight/yang/gen/v1/http/org/openroadm/pm/types/rev191129/PmDataTypeBuilder.java b/sdnr/wt/data-provider/model/src/main/java/org/opendaylight/yang/gen/v1/http/org/openroadm/pm/types/rev191129/PmDataTypeBuilder.java index b660787c6..f89197b82 100644 --- a/sdnr/wt/data-provider/model/src/main/java/org/opendaylight/yang/gen/v1/http/org/openroadm/pm/types/rev191129/PmDataTypeBuilder.java +++ b/sdnr/wt/data-provider/model/src/main/java/org/opendaylight/yang/gen/v1/http/org/openroadm/pm/types/rev191129/PmDataTypeBuilder.java @@ -1,11 +1,7 @@ package org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; import java.math.BigDecimal; -import java.math.BigInteger; -import java.util.Optional; import org.opendaylight.yangtools.yang.common.Uint64; /** @@ -17,20 +13,17 @@ import org.opendaylight.yangtools.yang.common.Uint64; * finished by the user. This class is generated only once to prevent loss of user code. * */ -@JsonPOJOBuilder(buildMethodName = "build", withPrefix = "with") +@JsonPOJOBuilder(buildMethodName = "build", withPrefix = "set") public class PmDataTypeBuilder { private Uint64 _uint64; - private BigInteger _unint64; private Long _int64; private BigDecimal _decimal64; - public PmDataTypeBuilder() { - System.out.println("-- Builder"); - } + public PmDataTypeBuilder() {} - public PmDataTypeBuilder setUnint64(String v) { - _unint64 = new BigInteger(v); - return this; + //Aluminium uses constructor + public PmDataTypeBuilder(String v) { + this.setUint64(v); } public PmDataTypeBuilder setUint64(String v) { @@ -39,7 +32,7 @@ public class PmDataTypeBuilder { } public PmDataTypeBuilder setInt64(String v) { - _int64 = new Long(v); + _int64 = Long.valueOf(v); return this; } @@ -49,37 +42,17 @@ public class PmDataTypeBuilder { } public PmDataType build() { - Optional<Constructor<PmDataType>> cons1; - try { - cons1 = Optional.of(PmDataType.class.getConstructor(BigInteger.class)); - } catch (NoSuchMethodException | SecurityException e) { - cons1 = Optional.empty(); - } - Optional<Constructor<PmDataType>> cons2; - try { - cons2 = Optional.of(PmDataType.class.getConstructor(Uint64.class)); - } catch (NoSuchMethodException | SecurityException e) { - cons2 = Optional.empty(); - } - - try { - if (_unint64 != null) { - return cons1.get().newInstance(_unint64); - } else if (_uint64 != null) { - return cons2.get().newInstance(_uint64); - } else if (_int64 != null) { - return new PmDataType(_int64); - } else { - return new PmDataType(_decimal64); - } - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException e) { - throw new IllegalArgumentException("Wrong stuff"); + if (_uint64 != null) { + return new PmDataType(_uint64); + } else if (_int64 != null) { + return new PmDataType(_int64); + } else { + return new PmDataType(_decimal64); } } public static PmDataType getDefaultInstance(String defaultValue) { - return new PmDataTypeBuilder().setInt64("-1").build(); + return new PmDataTypeBuilder().setUint64(defaultValue).build(); } } |