diff options
author | Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> | 2020-11-27 13:28:35 +0100 |
---|---|---|
committer | Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> | 2020-12-01 07:53:52 +0000 |
commit | 8016160afd589d269cfcdb09079e329dabd328b8 (patch) | |
tree | 80975ed9e65bcd49b6af60bf3191e9afc2c722fa /sdnr/wt/data-provider/model/src/main/java/org/opendaylight | |
parent | f88794b887842911b30a75afc53f87f660d1c1e7 (diff) |
SDN-R Server provide GUI cut through for ODLUX
SDN-R Server provide GUI cut through for ODLUX
Issue-ID: SDNC-1396
Change-Id: I9f510a03dcc07ab0efb84522611fc17e546da93f
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
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 | 82 |
1 files changed, 72 insertions, 10 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 98e93c363..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,23 +1,85 @@ package org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129; -import java.lang.String; -import java.lang.UnsupportedOperationException; + +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; /** - * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation. - * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32). + * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string + * representation. In some cases it is very difficult to automate it since there can be unions such as (uint32 - + * uint16), or (string - uint32). * - * The reason behind putting it under src/main/java is: - * This class is generated in form of a stub and needs to be finished by the user. This class is generated only once to prevent - * loss of user code. + * The reason behind putting it under src/main/java is: This class is generated in form of a stub and needs to be + * finished by the user. This class is generated only once to prevent loss of user code. * */ +@JsonPOJOBuilder(buildMethodName = "build", withPrefix = "with") public class PmDataTypeBuilder { - private PmDataTypeBuilder() { - //Exists only to defeat instantiation. + private Uint64 _uint64; + private BigInteger _unint64; + private Long _int64; + private BigDecimal _decimal64; + + public PmDataTypeBuilder() { + System.out.println("-- Builder"); + } + + public PmDataTypeBuilder setUnint64(String v) { + _unint64 = new BigInteger(v); + return this; + } + + public PmDataTypeBuilder setUint64(String v) { + _uint64 = Uint64.valueOf(v); + return this; + } + + public PmDataTypeBuilder setInt64(String v) { + _int64 = new Long(v); + return this; + } + + public PmDataTypeBuilder setDecimal64(String v) { + _decimal64 = new BigDecimal(v); + return this; + } + + 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"); + } } public static PmDataType getDefaultInstance(String defaultValue) { - throw new UnsupportedOperationException("Not yet implemented"); + return new PmDataTypeBuilder().setInt64("-1").build(); } } |