Ray Milkey | 140e478 | 2015-04-24 11:25:13 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Open Networking Laboratory |
| 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 | package org.onosproject.xosintegration; |
| 17 | |
| 18 | |
| 19 | import com.google.common.base.MoreObjects; |
| 20 | |
| 21 | public final class VoltTenant { |
| 22 | |
| 23 | private final String humanReadableName; |
| 24 | private final long id; |
| 25 | private final long providerService; |
| 26 | private final String serviceSpecificId; |
| 27 | private final String vlanId; |
| 28 | |
| 29 | private VoltTenant(String humanReadableName, long id, long providerService, |
| 30 | String serviceSpecificId, String vlanId) { |
| 31 | this.humanReadableName = humanReadableName; |
| 32 | this.id = id; |
| 33 | this.providerService = providerService; |
| 34 | this.serviceSpecificId = serviceSpecificId; |
| 35 | this.vlanId = vlanId; |
| 36 | } |
| 37 | |
| 38 | public static Builder builder() { |
| 39 | return new Builder(); |
| 40 | } |
| 41 | |
| 42 | public String humanReadableName() { |
| 43 | return humanReadableName; |
| 44 | } |
| 45 | |
| 46 | public long id() { |
| 47 | return id; |
| 48 | } |
| 49 | |
| 50 | public long providerService() { |
| 51 | return providerService; |
| 52 | } |
| 53 | |
| 54 | public String serviceSpecificId() { |
| 55 | return serviceSpecificId; |
| 56 | } |
| 57 | |
| 58 | public String vlanId() { |
| 59 | return vlanId; |
| 60 | } |
| 61 | |
| 62 | public static final class Builder { |
| 63 | private String humanReadableName = "unknown"; |
| 64 | private long id = 0; |
| 65 | private long providerService = 0; |
| 66 | private String serviceSpecificId = "unknown"; |
| 67 | private String vlanId = "unknown"; |
| 68 | |
| 69 | public Builder withHumanReadableName(String humanReadableName) { |
| 70 | this.humanReadableName = humanReadableName; |
| 71 | return this; |
| 72 | } |
| 73 | |
| 74 | public Builder withId(long id) { |
| 75 | this.id = id; |
| 76 | return this; |
| 77 | } |
| 78 | |
| 79 | public Builder withProviderService(long providerService) { |
| 80 | this.providerService = providerService; |
| 81 | return this; |
| 82 | } |
| 83 | |
| 84 | public Builder withServiceSpecificId(String serviceSpecificId) { |
| 85 | this.serviceSpecificId = serviceSpecificId; |
| 86 | return this; |
| 87 | } |
| 88 | |
| 89 | public Builder withVlanId(String vlanId) { |
| 90 | this.vlanId = vlanId; |
| 91 | return this; |
| 92 | } |
| 93 | |
| 94 | public VoltTenant build() { |
| 95 | return new VoltTenant(humanReadableName, id, providerService, |
| 96 | serviceSpecificId, vlanId); |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | @Override |
| 101 | public String toString() { |
| 102 | return MoreObjects.toStringHelper(getClass()) |
| 103 | .add("humanReadableName", humanReadableName()) |
| 104 | .add("id", id()) |
| 105 | .add("providerService", providerService()) |
| 106 | .add("serviceSpecificId", serviceSpecificId()) |
| 107 | .add("vlanId", vlanId()) |
| 108 | .toString(); |
| 109 | } |
| 110 | |
| 111 | } |