a929061c34f0a0720f38f2d3d8ed00514d0a4a56
[yangtools.git] / yang / yang-data-jaxen / src / main / java / org / opendaylight / yangtools / yang / data / jaxen / JaxenDocument.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 package org.opendaylight.yangtools.yang.data.jaxen;
9
10 import com.google.common.base.Preconditions;
11 import javax.annotation.Nonnull;
12 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
13 import org.opendaylight.yangtools.yang.data.api.schema.xpath.XPathDocument;
14 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
15
16 final class JaxenDocument implements XPathDocument {
17     private final NormalizedNode<?, ?> root;
18     private final SchemaContext context;
19
20     JaxenDocument(final JaxenSchemaContext context, final NormalizedNode<?, ?> root) {
21         this.root = Preconditions.checkNotNull(root);
22         this.context = context.getSchemaContext();
23     }
24
25     @Nonnull
26     @Override
27     public NormalizedNode<?, ?> getRootNode() {
28         return root;
29     }
30
31     @Nonnull
32     SchemaContext getSchemaContext() {
33         return context;
34     }
35 }