blob: 2f2bc0e334439e83a2f2cb61f961f49f76e59afc [file] [log] [blame]
Thomas Vachuskafe8c98a2015-02-04 01:24:32 -08001/*
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 */
16package org.onosproject.ui;
17
18import com.google.common.base.MoreObjects;
19
20import java.util.Objects;
21
22/**
23 * Represents user interface view addition.
24 */
25public class UiView {
26
27 private final String id;
28 private final String label;
29
30 /**
31 * Creates a new user interface view descriptor.
32 *
33 * @param id view identifier
34 * @param label view label
35 */
36 public UiView(String id, String label) {
37 this.id = id;
38 this.label = label;
39 }
40
41 /**
42 * Returns the view identifier.
43 *
44 * @return view id
45 */
46 public String id() {
47 return id;
48 }
49
50 /**
51 * Returns the view label.
52 *
53 * @return view label
54 */
55 public String label() {
56 return label;
57 }
58
59 @Override
60 public int hashCode() {
61 return Objects.hash(id);
62 }
63
64 @Override
65 public boolean equals(Object obj) {
66 if (this == obj) {
67 return true;
68 }
69 if (obj == null || getClass() != obj.getClass()) {
70 return false;
71 }
72 final UiView other = (UiView) obj;
73 return Objects.equals(this.id, other.id);
74 }
75
76 @Override
77 public String toString() {
78 return MoreObjects.toStringHelper(this)
79 .add("id", id)
80 .add("label", label)
81 .toString();
82 }
83}