blob: ba6f7e2fed7342c90cd813a474593fbffb7b279e [file] [log] [blame]
Ramon Casellas99c16252019-05-31 14:29:00 +02001/*
2 * Copyright 2018-present Open Networking Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15
16 * This work was partially supported by EC H2020 project METRO-HAUL (761727).
17 */
18package org.onosproject.drivers.odtn.openroadm;
19
20
21public class OpenRoadmInterface {
22
23 protected String name;
24 protected String description;
25 protected String type;
26 protected String administrativeState;
27 protected String supportingCircuitPack;
28 protected String supportingPort;
29 protected String supportingInterface;
30
31 public abstract static class Builder<T extends Builder<T>> {
32 protected String name;
33 protected String description;
34 protected String type;
35 protected String administrativeState;
36 protected String supportingCircuitPack;
37 protected String supportingPort;
38 protected String supportingInterface;
39
40 protected abstract T self();
41
42 public T name(String name) {
43 this.name = name;
44 return self();
45 }
46
47 public T description(String description) {
48 this.description = description;
49 return self();
50 }
51
52 public T administrativeState(String administrativeState) {
53 this.administrativeState = administrativeState;
54 return self();
55 }
56
57 public T supportingCircuitPack(String supportingCircuitPack) {
58 this.supportingCircuitPack = supportingCircuitPack;
59 return self();
60 }
61
62 public T supportingPort(String supportingPort) {
63 this.supportingPort = supportingPort;
64 return self();
65 }
66
67 public T supportingInterface(String supportingInterface) {
68 this.supportingInterface = supportingInterface;
69 return self();
70 }
71
72 public OpenRoadmInterface build() { //
73 return new OpenRoadmInterface(this);
74 }
75 }
76
77 private static class Builder2 extends Builder<Builder2> {
78 @Override
79 protected Builder2 self() {
80 return this;
81 }
82 }
83
84 public static Builder<?> builder() {
85 return new Builder2();
86 }
87
88 protected OpenRoadmInterface(Builder<?> builder) {
89 this.name = builder.name;
90 this.description = builder.description;
91 this.type = builder.type;
92 this.administrativeState = builder.administrativeState;
93 this.supportingCircuitPack = builder.supportingCircuitPack;
94 this.supportingPort = builder.supportingPort;
95 this.supportingInterface = builder.supportingInterface;
96 }
97}