2 * Copyright (c) 2015 Brocade Communications 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.mdsal.common.api.clustering;
10 import com.google.common.base.Preconditions;
11 import javax.annotation.Nonnull;
12 import org.opendaylight.yangtools.concepts.Path;
15 * A DTO that encapsulates an ownership change for an entity.
17 * @author Thomas Pantelis
19 * @param <P> the instance identifier path type
20 * @param <E> the GenericEntity type
22 public class GenericEntityOwnershipChange<P extends Path<P>, E extends GenericEntity<P>> {
23 private final E entity;
24 private final EntityOwnershipChangeState state;
26 public GenericEntityOwnershipChange(@Nonnull E entity, @Nonnull EntityOwnershipChangeState state) {
27 this.entity = Preconditions.checkNotNull(entity, "entity can't be null");
28 this.state = Preconditions.checkNotNull(state, "state can't be null");
32 * Returns the entity whose ownership status changed.
35 @Nonnull public E getEntity() {
40 * Returns the ownership change state.
41 * @return an EntityOwnershipChangeState enum
43 @Nonnull public EntityOwnershipChangeState getState() {
48 public String toString() {
49 return getClass().getSimpleName() + " [entity=" + entity + ", state=" + state + "]";