- Preconditions.checkNotNull(pathArgument, "pathArgument should not be null");
-
- if(pathArgument instanceof YangInstanceIdentifier.AugmentationIdentifier){
- return AUGMENTATION_IDENTIFIER.ordinal();
- } else if(pathArgument instanceof YangInstanceIdentifier.NodeIdentifier){
- return NODE_IDENTIFIER.ordinal();
- } else if(pathArgument instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates){
- return NODE_IDENTIFIER_WITH_PREDICATES.ordinal();
- } else if(pathArgument instanceof YangInstanceIdentifier.NodeWithValue){
- return NODE_IDENTIFIER_WITH_VALUE.ordinal();
+
+ PathArgumentType type = CLASS_TO_ENUM_MAP.get(pathArgument.getClass());
+ if(type == null) {
+ throw new IllegalArgumentException("Unknown type of PathArgument = " + pathArgument);