Remove yang-test
[controller.git] / opendaylight / config / config-api / src / main / java / org / opendaylight / controller / config / api / jmx / CommitStatus.java
1 /*
2  * Copyright (c) 2013, 2017 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.jmx;
9
10 import java.beans.ConstructorProperties;
11 import java.util.Collections;
12 import java.util.List;
13 import javax.annotation.concurrent.Immutable;
14 import javax.management.ObjectName;
15
16 @Immutable
17 public class CommitStatus {
18     private final List<ObjectName> newInstances;
19     private final List<ObjectName> reusedInstances;
20     private final List<ObjectName> recreatedInstances;
21
22     /**
23      * Constructor.
24      *
25      * @param newInstances
26      *            newly created instances
27      * @param reusedInstances
28      *            reused instances
29      * @param recreatedInstances
30      *            recreated instances
31      */
32     @ConstructorProperties({ "newInstances", "reusedInstances", "recreatedInstances" })
33     public CommitStatus(final List<ObjectName> newInstances, final List<ObjectName> reusedInstances,
34             final List<ObjectName> recreatedInstances) {
35         this.newInstances = Collections.unmodifiableList(newInstances);
36         this.reusedInstances = Collections.unmodifiableList(reusedInstances);
37         this.recreatedInstances = Collections.unmodifiableList(recreatedInstances);
38     }
39
40     public List<ObjectName> getNewInstances() {
41         return newInstances;
42     }
43
44     public List<ObjectName> getReusedInstances() {
45         return reusedInstances;
46     }
47
48     public List<ObjectName> getRecreatedInstances() {
49         return recreatedInstances;
50     }
51
52     @Override
53     public int hashCode() {
54         final int prime = 31;
55         int result = 1;
56         result = prime * result + (newInstances == null ? 0 : newInstances.hashCode());
57         result = prime * result + (recreatedInstances == null ? 0 : recreatedInstances.hashCode());
58         result = prime * result + (reusedInstances == null ? 0 : reusedInstances.hashCode());
59         return result;
60     }
61
62     @Override
63     public boolean equals(final Object obj) {
64         if (this == obj) {
65             return true;
66         }
67         if (obj == null) {
68             return false;
69         }
70         if (getClass() != obj.getClass()) {
71             return false;
72         }
73         CommitStatus other = (CommitStatus) obj;
74         if (newInstances == null) {
75             if (other.newInstances != null) {
76                 return false;
77             }
78         } else if (!newInstances.equals(other.newInstances)) {
79             return false;
80         }
81         if (recreatedInstances == null) {
82             if (other.recreatedInstances != null) {
83                 return false;
84             }
85         } else if (!recreatedInstances.equals(other.recreatedInstances)) {
86             return false;
87         }
88         if (reusedInstances == null) {
89             if (other.reusedInstances != null) {
90                 return false;
91             }
92         } else if (!reusedInstances.equals(other.reusedInstances)) {
93             return false;
94         }
95         return true;
96     }
97
98     @Override
99     public String toString() {
100         return "CommitStatus [newInstances=" + newInstances + ", reusedInstances=" + reusedInstances
101                 + ", recreatedInstances=" + recreatedInstances + "]";
102     }
103
104 }