blob: 0de5788e55f09fe0a073f6ea1d7319a52813c7fc [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
2 * Copyright 2014 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 */
tome7f01ee2014-10-10 00:17:33 -070016package org.onlab.onos;
17
Thomas Vachuskae0f804a2014-10-27 23:40:48 -070018import org.onlab.onos.core.ApplicationId;
19
tome7f01ee2014-10-10 00:17:33 -070020import java.util.Objects;
21
22/**
23 * Test application ID.
24 */
25public class TestApplicationId implements ApplicationId {
26
27 private final String name;
28 private final short id;
29
30 public TestApplicationId(String name) {
31 this.name = name;
32 this.id = (short) Objects.hash(name);
33 }
34
35 public static ApplicationId create(String name) {
36 return new TestApplicationId(name);
37 }
38
39 @Override
40 public short id() {
41 return id;
42 }
43
44 @Override
45 public String name() {
46 return name;
47 }
48}