2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.config.api.jmx;
10 import javax.annotation.concurrent.Immutable;
11 import javax.management.ObjectName;
12 import java.beans.ConstructorProperties;
13 import java.util.Collections;
14 import java.util.List;
17 public class CommitStatus {
18 private final List<ObjectName> newInstances, reusedInstances,
22 * @param newInstances newly created instances
23 * @param reusedInstances reused instances
24 * @param recreatedInstances recreated instances
26 @ConstructorProperties({"newInstances", "reusedInstances",
27 "recreatedInstances"})
28 public CommitStatus(List<ObjectName> newInstances,
29 List<ObjectName> reusedInstances,
30 List<ObjectName> recreatedInstances) {
31 this.newInstances = Collections.unmodifiableList(newInstances);
32 this.reusedInstances = Collections.unmodifiableList(reusedInstances);
33 this.recreatedInstances = Collections
34 .unmodifiableList(recreatedInstances);
38 * @return list of objectNames representing newly created instances
40 public List<ObjectName> getNewInstances() {
45 * @return list of objectNames representing reused instances
47 public List<ObjectName> getReusedInstances() {
48 return reusedInstances;
52 * @return list of objectNames representing recreated instances
54 public List<ObjectName> getRecreatedInstances() {
55 return recreatedInstances;
59 public int hashCode() {
62 result = prime * result
63 + ((newInstances == null) ? 0 : newInstances.hashCode());
66 + ((recreatedInstances == null) ? 0 : recreatedInstances
68 result = prime * result
69 + ((reusedInstances == null) ? 0 : reusedInstances.hashCode());
74 public boolean equals(Object obj) {
81 if (getClass() != obj.getClass()) {
84 CommitStatus other = (CommitStatus) obj;
85 if (newInstances == null) {
86 if (other.newInstances != null) {
89 } else if (!newInstances.equals(other.newInstances)) {
92 if (recreatedInstances == null) {
93 if (other.recreatedInstances != null) {
96 } else if (!recreatedInstances.equals(other.recreatedInstances)) {
99 if (reusedInstances == null) {
100 if (other.reusedInstances != null) {
103 } else if (!reusedInstances.equals(other.reusedInstances)) {
110 public String toString() {
111 return "CommitStatus [newInstances=" + newInstances
112 + ", reusedInstances=" + reusedInstances
113 + ", recreatedInstances=" + recreatedInstances + "]";