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.xml;
10 import java.util.List;
11 import java.util.Map.Entry;
12 import javax.xml.namespace.NamespaceContext;
13 import org.eclipse.jdt.annotation.Nullable;
14 import org.opendaylight.yangtools.yang.common.XMLNamespace;
15 import org.opendaylight.yangtools.yang.data.util.DataSchemaContextTree;
16 import org.opendaylight.yangtools.yang.model.api.Module;
18 final class InstanceIdentifierSerializer extends AbstractInstanceIdentifierCodec {
19 private final NamespacePrefixes prefixes;
21 InstanceIdentifierSerializer(final DataSchemaContextTree dataContextTree, final NamespaceContext nsContext,
22 final @Nullable PreferredPrefixes pref) {
23 super(dataContextTree);
24 prefixes = new NamespacePrefixes(nsContext, pref);
27 List<Entry<XMLNamespace, String>> emittedPrefixes() {
28 return prefixes.emittedPrefixes();
32 protected Module moduleForPrefix(final String prefix) {
33 // This is deserialize() path, we do not support that in this class
34 throw new UnsupportedOperationException("Not implemented");
38 protected String prefixForNamespace(final XMLNamespace namespace) {
39 return prefixes.encodePrefix(namespace);