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
9 package org.opendaylight.controller.cluster.datastore.node.utils.serialization;
11 import com.google.common.base.Preconditions;
12 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
14 public enum PathArgumentType {
15 AUGMENTATION_IDENTIFIER,
17 NODE_IDENTIFIER_WITH_VALUE,
18 NODE_IDENTIFIER_WITH_PREDICATES;
20 public static int getSerializablePathArgumentType(YangInstanceIdentifier.PathArgument pathArgument){
21 Preconditions.checkNotNull(pathArgument, "pathArgument should not be null");
23 if(pathArgument instanceof YangInstanceIdentifier.AugmentationIdentifier){
24 return AUGMENTATION_IDENTIFIER.ordinal();
25 } else if(pathArgument instanceof YangInstanceIdentifier.NodeIdentifier){
26 return NODE_IDENTIFIER.ordinal();
27 } else if(pathArgument instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates){
28 return NODE_IDENTIFIER_WITH_PREDICATES.ordinal();
29 } else if(pathArgument instanceof YangInstanceIdentifier.NodeWithValue){
30 return NODE_IDENTIFIER_WITH_VALUE.ordinal();
32 throw new IllegalArgumentException("Unknown type of PathArgument = " + pathArgument.toString());