aboutsummaryrefslogtreecommitdiffstats
path: root/cps-path-parser
diff options
context:
space:
mode:
Diffstat (limited to 'cps-path-parser')
-rw-r--r--cps-path-parser/pom.xml2
-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
3 files changed, 13 insertions, 6 deletions
diff --git a/cps-path-parser/pom.xml b/cps-path-parser/pom.xml
index 3a468eedf5..c95d6a8f47 100644
--- a/cps-path-parser/pom.xml
+++ b/cps-path-parser/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.onap.cps</groupId>
<artifactId>cps-parent</artifactId>
- <version>3.2.3-SNAPSHOT</version>
+ <version>3.2.4-SNAPSHOT</version>
<relativePath>../cps-parent/pom.xml</relativePath>
</parent>
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 c9df8df904..3985455263 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 60f0e2efcd..bde9b0638f 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();
}
/**