aaa2a7cd1dee055adb7d14c618c20ece9aae9b4b
[mdsal.git] / entityownership / mdsal-eos-binding-api / src / main / java / org / opendaylight / mdsal / binding / api / clustering / Entity.java
1 /*
2  * Copyright (c) 2015 Brocade Communications 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.mdsal.binding.api.clustering;
9
10 import com.google.common.annotations.Beta;
11 import com.google.common.base.Preconditions;
12 import javax.annotation.Nonnull;
13 import org.opendaylight.mdsal.common.api.clustering.GenericEntity;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.core.general.entity.rev150930.EntityKey;
15 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
16
17 /**
18  * Binding version of {@link GenericEntity}.
19  *
20  * @author Thomas Pantelis
21  */
22 @Beta
23 public class Entity extends GenericEntity<InstanceIdentifier<?>> {
24     private static final long serialVersionUID = 1L;
25
26     /** Constructs an instance.
27      *
28      * @param type the entity type
29      * @param id the entity id.
30      */
31     public Entity(@Nonnull final String type, @Nonnull final InstanceIdentifier<?> id) {
32         super(type, id);
33     }
34
35     /**
36      * Construct an Entity with an with a name. The general-entity schema is used to construct the
37      * InstanceIdentifier.
38      *
39      * @param type the type of the entity
40      * @param entityName the name of the entity used to construct a general-entity InstanceIdentifier
41      */
42     public Entity(@Nonnull String type, @Nonnull String entityName) {
43         super(type, InstanceIdentifier.builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.
44                 mdsal.core.general.entity.rev150930.Entity.class,
45                     new EntityKey(Preconditions.checkNotNull(entityName, "entityName should not be null"))).build());
46     }
47 }