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.binfmt;
10 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
11 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
12 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
15 final class LithiumPathArgument {
16 static final byte AUGMENTATION_IDENTIFIER = 1;
17 static final byte NODE_IDENTIFIER = 2;
18 static final byte NODE_IDENTIFIER_WITH_VALUE = 3;
19 static final byte NODE_IDENTIFIER_WITH_PREDICATES = 4;
21 private LithiumPathArgument() {
25 static byte getSerializablePathArgumentType(final PathArgument pathArgument) {
26 if (pathArgument instanceof NodeIdentifier) {
27 return NODE_IDENTIFIER;
28 } else if (pathArgument instanceof NodeIdentifierWithPredicates) {
29 return NODE_IDENTIFIER_WITH_PREDICATES;
30 } else if (pathArgument instanceof NodeWithValue) {
31 return NODE_IDENTIFIER_WITH_VALUE;
33 throw new IllegalArgumentException("Unknown type of PathArgument = " + pathArgument);