/* * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.mdsal.common.api.clustering; import com.google.common.base.Preconditions; import javax.annotation.Nonnull; import org.opendaylight.yangtools.concepts.Path; /** * A DTO that encapsulates an ownership change for an entity. * * @author Thomas Pantelis * * @param
the instance identifier path type
* @param , E extends GenericEntity > {
private final E entity;
private final EntityOwnershipChangeState state;
public GenericEntityOwnershipChange(@Nonnull E entity, @Nonnull EntityOwnershipChangeState state) {
this.entity = Preconditions.checkNotNull(entity, "entity can't be null");
this.state = Preconditions.checkNotNull(state, "state can't be null");
}
/**
* Returns the entity whose ownership status changed.
* @return the entity
*/
@Nonnull public E getEntity() {
return entity;
}
/**
* Returns the ownership change state.
* @return an EntityOwnershipChangeState enum
*/
@Nonnull public EntityOwnershipChangeState getState() {
return state;
}
@Override
public String toString() {
return getClass().getSimpleName() + " [entity=" + entity + ", state=" + state + "]";
}
}