Initial code drop of yang model driven configuration system
[controller.git] / opendaylight / config / config-api / src / main / java / org / opendaylight / controller / config / api / ModuleIdentifier.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.config.api;
9
10 import org.opendaylight.protocol.concepts.Identifier;
11
12 public class ModuleIdentifier implements Identifier {
13     private static final long serialVersionUID = 1L;
14     private final String factoryName, instanceName;
15
16     public ModuleIdentifier(String factoryName, String instanceName) {
17         if (factoryName == null)
18             throw new IllegalArgumentException(
19                     "Parameter 'factoryName' is null");
20         if (instanceName == null)
21             throw new IllegalArgumentException(
22                     "Parameter 'instanceName' is null");
23         this.factoryName = factoryName;
24         this.instanceName = instanceName;
25     }
26
27     public String getFactoryName() {
28         return factoryName;
29     }
30
31     public String getInstanceName() {
32         return instanceName;
33     }
34
35     @Override
36     public boolean equals(Object o) {
37         if (this == o)
38             return true;
39         if (o == null || getClass() != o.getClass())
40             return false;
41
42         ModuleIdentifier that = (ModuleIdentifier) o;
43
44         if (!factoryName.equals(that.factoryName))
45             return false;
46         if (!instanceName.equals(that.instanceName))
47             return false;
48
49         return true;
50     }
51
52     @Override
53     public int hashCode() {
54         int result = factoryName.hashCode();
55         result = 31 * result + instanceName.hashCode();
56         return result;
57     }
58
59     @Override
60     public String toString() {
61         return "ModuleIdentifier{" + "factoryName='" + factoryName + '\''
62                 + ", instanceName='" + instanceName + '\'' + '}';
63     }
64 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.