summaryrefslogtreecommitdiffstats
path: root/cps-path-parser
diff options
context:
space:
mode:
Diffstat (limited to 'cps-path-parser')
-rw-r--r--cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathQuery.java11
-rw-r--r--cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathUtil.java6
2 files changed, 12 insertions, 5 deletions
diff --git a/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathQuery.java b/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathQuery.java
index c9df8df90..398545526 100644
--- a/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathQuery.java
+++ b/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathQuery.java
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation
+ * Copyright (C) 2021-2023 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -80,4 +80,13 @@ public class CpsPathQuery {
return textFunctionConditionLeafName != null;
}
+ /**
+ * Returns boolean indicating xpath is an absolute path to a list element.
+ *
+ * @return true if xpath is an absolute path to a list element
+ */
+ public boolean isPathToListElement() {
+ return cpsPathPrefixType == ABSOLUTE && hasLeafConditions();
+ }
+
}
diff --git a/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathUtil.java b/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathUtil.java
index 60f0e2efc..bde9b0638 100644
--- a/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathUtil.java
+++ b/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathUtil.java
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation
+ * Copyright (C) 2022-2023 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,8 +20,6 @@
package org.onap.cps.cpspath.parser;
-import static org.onap.cps.cpspath.parser.CpsPathPrefixType.ABSOLUTE;
-
import java.util.List;
import lombok.AccessLevel;
import lombok.Getter;
@@ -75,7 +73,7 @@ public class CpsPathUtil {
*/
public static boolean isPathToListElement(final String xpathSource) {
final CpsPathQuery cpsPathQuery = getCpsPathBuilder(xpathSource).build();
- return cpsPathQuery.getCpsPathPrefixType() == ABSOLUTE && cpsPathQuery.hasLeafConditions();
+ return cpsPathQuery.isPathToListElement();
}
/**