blob: 04012db06670ac7b55c72d3adb10708758612321 [file] [log] [blame]
alshabib92c65ad2014-10-08 21:56:05 -07001package org.onlab.onos.impl;
2
3import java.util.Objects;
4
5import org.onlab.onos.ApplicationId;
6
7/**
8 * Application id generator class.
9 */
10public class DefaultApplicationId implements ApplicationId {
11
12
13 private final short id;
14 private final String name;
15
16
17 // Ban public construction
18 protected DefaultApplicationId(Short id, String identifier) {
19 this.id = id;
20 this.name = identifier;
21 }
22
23 @Override
24 public short id() {
25 return id;
26 }
27
28 @Override
29 public String name() {
30 return name;
31 }
32
33 @Override
34 public int hashCode() {
35 return Objects.hash(id);
36 }
37
38 @Override
39 public boolean equals(Object obj) {
40 if (this == obj) {
41 return true;
42 }
43 if (obj == null) {
44 return false;
45 }
46 if (!(obj instanceof DefaultApplicationId)) {
47 return false;
48 }
49 DefaultApplicationId other = (DefaultApplicationId) obj;
50 return Objects.equals(this.id, other.id);
51 }
52}