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 java.beans.ConstructorProperties;
11 import java.util.Collections;
12 import java.util.List;
14 import javax.annotation.concurrent.Immutable;
15 import javax.management.ObjectName;
18 public class CommitStatus {
19 private final List<ObjectName> newInstances, reusedInstances,
25 * newly created instances
26 * @param reusedInstances
28 * @param recreatedInstances
31 @ConstructorProperties({ "newInstances", "reusedInstances",
32 "recreatedInstances" })
33 public CommitStatus(List<ObjectName> newInstances,
34 List<ObjectName> reusedInstances,
35 List<ObjectName> recreatedInstances) {
36 this.newInstances = Collections.unmodifiableList(newInstances);
37 this.reusedInstances = Collections.unmodifiableList(reusedInstances);
38 this.recreatedInstances = Collections
39 .unmodifiableList(recreatedInstances);
44 * @return list of objectNames representing newly created instances
46 public List<ObjectName> getNewInstances() {
52 * @return list of objectNames representing reused instances
54 public List<ObjectName> getReusedInstances() {
55 return reusedInstances;
60 * @return list of objectNames representing recreated instances
62 public List<ObjectName> getRecreatedInstances() {
63 return recreatedInstances;
67 public int hashCode() {
70 result = prime * result
71 + ((newInstances == null) ? 0 : newInstances.hashCode());
74 + ((recreatedInstances == null) ? 0 : recreatedInstances
76 result = prime * result
77 + ((reusedInstances == null) ? 0 : reusedInstances.hashCode());
82 public boolean equals(Object obj) {
87 if (getClass() != obj.getClass())
89 CommitStatus other = (CommitStatus) obj;
90 if (newInstances == null) {
91 if (other.newInstances != null)
93 } else if (!newInstances.equals(other.newInstances))
95 if (recreatedInstances == null) {
96 if (other.recreatedInstances != null)
98 } else if (!recreatedInstances.equals(other.recreatedInstances))
100 if (reusedInstances == null) {
101 if (other.reusedInstances != null)
103 } else if (!reusedInstances.equals(other.reusedInstances))
109 public String toString() {
110 return "CommitStatus [newInstances=" + newInstances
111 + ", reusedInstances=" + reusedInstances
112 + ", recreatedInstances=" + recreatedInstances + "]";