f89197b82bec1e01fa6e7498441a65267707fe21
[ccsdk/features.git] /
1 package org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129;
2
3 import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
4 import java.math.BigDecimal;
5 import org.opendaylight.yangtools.yang.common.Uint64;
6
7 /**
8  * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string
9  * representation. In some cases it is very difficult to automate it since there can be unions such as (uint32 -
10  * uint16), or (string - uint32).
11  *
12  * The reason behind putting it under src/main/java is: This class is generated in form of a stub and needs to be
13  * finished by the user. This class is generated only once to prevent loss of user code.
14  *
15  */
16 @JsonPOJOBuilder(buildMethodName = "build", withPrefix = "set")
17 public class PmDataTypeBuilder {
18     private Uint64 _uint64;
19     private Long _int64;
20     private BigDecimal _decimal64;
21
22     public PmDataTypeBuilder() {}
23
24     //Aluminium uses constructor
25     public PmDataTypeBuilder(String v) {
26         this.setUint64(v);
27     }
28
29     public PmDataTypeBuilder setUint64(String v) {
30         _uint64 = Uint64.valueOf(v);
31         return this;
32     }
33
34     public PmDataTypeBuilder setInt64(String v) {
35         _int64 = Long.valueOf(v);
36         return this;
37     }
38
39     public PmDataTypeBuilder setDecimal64(String v) {
40         _decimal64 = new BigDecimal(v);
41         return this;
42     }
43
44     public PmDataType build() {
45         if (_uint64 != null) {
46             return new PmDataType(_uint64);
47         } else if (_int64 != null) {
48             return new PmDataType(_int64);
49         } else {
50             return new PmDataType(_decimal64);
51         }
52     }
53
54     public static PmDataType getDefaultInstance(String defaultValue) {
55         return new PmDataTypeBuilder().setUint64(defaultValue).build();
56     }
57
58 }