diff options
Diffstat (limited to 'sdnr/wt/data-provider/model/src/main/java/org/opendaylight/yang/gen/v1/http')
-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, 40 insertions, 13 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 f89197b82..b660787c6 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,7 +1,11 @@ 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; /** @@ -13,17 +17,20 @@ 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 = "set") +@JsonPOJOBuilder(buildMethodName = "build", withPrefix = "with") public class PmDataTypeBuilder { private Uint64 _uint64; + private BigInteger _unint64; private Long _int64; private BigDecimal _decimal64; - public PmDataTypeBuilder() {} + public PmDataTypeBuilder() { + System.out.println("-- Builder"); + } - //Aluminium uses constructor - public PmDataTypeBuilder(String v) { - this.setUint64(v); + public PmDataTypeBuilder setUnint64(String v) { + _unint64 = new BigInteger(v); + return this; } public PmDataTypeBuilder setUint64(String v) { @@ -32,7 +39,7 @@ public class PmDataTypeBuilder { } public PmDataTypeBuilder setInt64(String v) { - _int64 = Long.valueOf(v); + _int64 = new Long(v); return this; } @@ -42,17 +49,37 @@ public class PmDataTypeBuilder { } public PmDataType build() { - if (_uint64 != null) { - return new PmDataType(_uint64); - } else if (_int64 != null) { - return new PmDataType(_int64); - } else { - return new PmDataType(_decimal64); + 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"); } } public static PmDataType getDefaultInstance(String defaultValue) { - return new PmDataTypeBuilder().setUint64(defaultValue).build(); + return new PmDataTypeBuilder().setInt64("-1").build(); } } |