Remove yang-test
[controller.git] / opendaylight / config / config-manager-facade-xml / src / main / java / org / opendaylight / controller / config / facade / xml / mapping / IdentityMapping.java
1 /*
2  * Copyright (c) 2015 Cisco 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
9 package org.opendaylight.controller.config.facade.xml.mapping;
10
11 import com.google.common.base.Preconditions;
12 import com.google.common.collect.Maps;
13 import java.util.Map;
14 import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
15
16 public class IdentityMapping {
17     private final Map<String, IdentitySchemaNode> identityNameToSchemaNode;
18
19     public IdentityMapping() {
20         this.identityNameToSchemaNode = Maps.newHashMap();
21     }
22
23     public void addIdSchemaNode(final IdentitySchemaNode node) {
24         String name = node.getQName().getLocalName();
25         Preconditions.checkState(!identityNameToSchemaNode.containsKey(name));
26         identityNameToSchemaNode.put(name, node);
27     }
28
29     public boolean containsIdName(final String idName) {
30         return identityNameToSchemaNode.containsKey(idName);
31     }
32
33 }