2 * Copyright (c) 2016 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.restconf.nb.rfc8040.utils.parser;
10 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
11 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
14 * Codec for identifier to serialize {@link YangInstanceIdentifier} to
15 * {@link String} and deserialize {@link String} to
16 * {@link YangInstanceIdentifier}.
19 public final class IdentifierCodec {
20 private IdentifierCodec() {
24 public static String serialize(final YangInstanceIdentifier data, final EffectiveModelContext schemaContext) {
25 return YangInstanceIdentifierSerializer.create(schemaContext, data);
28 public static YangInstanceIdentifier deserialize(final String data, final EffectiveModelContext schemaContext) {
29 return data == null ? YangInstanceIdentifier.of()
30 : YangInstanceIdentifierDeserializer.create(schemaContext, data).path;