4c24c8a7f500c250237ce04cd4e055a42d003121
[controller.git] / opendaylight / md-sal / sal-common-impl / src / main / java / org / opendaylight / controller / md / sal / common / impl / util / compat / DataSchemaContainerProxy.java
1 /*
2  * Copyright (c) 2014 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 package org.opendaylight.controller.md.sal.common.impl.util.compat;
9
10 import java.util.Collections;
11 import java.util.HashMap;
12 import java.util.Map;
13 import java.util.Set;
14
15 import org.opendaylight.yangtools.yang.common.QName;
16 import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
17 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
18 import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
19 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
20 import org.opendaylight.yangtools.yang.model.api.UsesNode;
21
22 class DataSchemaContainerProxy implements DataNodeContainer {
23
24     private final Set<DataSchemaNode> realChildSchemas;
25     private final Map<QName, DataSchemaNode> mappedChildSchemas;
26
27     public DataSchemaContainerProxy(final Set<DataSchemaNode> realChildSchema) {
28         realChildSchemas = realChildSchema;
29         mappedChildSchemas = new HashMap<>();
30         for(DataSchemaNode schema : realChildSchemas) {
31             mappedChildSchemas.put(schema.getQName(),schema);
32         }
33     }
34
35     @Override
36     public DataSchemaNode getDataChildByName(final QName name) {
37         return mappedChildSchemas.get(name);
38     }
39
40     @Override
41     public Set<DataSchemaNode> getChildNodes() {
42         return realChildSchemas;
43     }
44
45     @Override
46     public Set<GroupingDefinition> getGroupings() {
47         return Collections.emptySet();
48     }
49
50     @Override
51     public Set<TypeDefinition<?>> getTypeDefinitions() {
52         return Collections.emptySet();
53     }
54
55     @Override
56     public Set<UsesNode> getUses() {
57         return Collections.emptySet();
58     }
59
60 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.