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