2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.yangtools.yang.data.codec.gson;
10 import com.google.common.base.Preconditions;
14 import javax.annotation.Nonnull;
15 import org.opendaylight.yangtools.yang.common.QName;
18 * Abstract base class for {@link JSONNormalizedNodeStreamWriter} recursion
19 * levels which emit a QName-identified node.
21 abstract class JSONStreamWriterQNameContext extends JSONStreamWriterContext {
22 private final QName qname;
24 protected JSONStreamWriterQNameContext(final JSONStreamWriterContext parent, final QName qname,
25 final boolean mandatory) {
26 super(parent, mandatory);
27 this.qname = Preconditions.checkNotNull(qname);
31 * Returns the node's identifier as a QName.
33 * @return QName identifier
35 protected final QName getQName() {
41 protected final URI getNamespace() {
42 return qname.getNamespace();