Skip to content

Commit 047396d

Browse files
committed
TEDEFO-4822 Add getXpathInfo() to SdkField
Lazy-initialized XPathInfo provides parsed XPath structure.
1 parent 57087ca commit 047396d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/main/java/eu/europa/ted/eforms/sdk/entity/SdkField.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import java.util.Objects;
44
import com.fasterxml.jackson.databind.JsonNode;
5+
import eu.europa.ted.eforms.xpath.XPathInfo;
6+
import eu.europa.ted.eforms.xpath.XPathProcessor;
57

68
public abstract class SdkField implements Comparable<SdkField> {
79
private final String id;
@@ -12,6 +14,7 @@ public abstract class SdkField implements Comparable<SdkField> {
1214
private final String codelistId;
1315
private final boolean repeatable;
1416
private SdkNode parentNode;
17+
private XPathInfo xpathInfo;
1518

1619
@SuppressWarnings("unused")
1720
private SdkField() {
@@ -109,6 +112,18 @@ public void setParentNode(SdkNode parentNode) {
109112
this.parentNode = parentNode;
110113
}
111114

115+
/**
116+
* Returns parsed XPath information for this field.
117+
* Provides access to attribute info, path decomposition, and predicate checks.
118+
* Lazily initialized on first access.
119+
*/
120+
public XPathInfo getXpathInfo() {
121+
if (this.xpathInfo == null) {
122+
this.xpathInfo = XPathProcessor.parse(this.xpathAbsolute);
123+
}
124+
return this.xpathInfo;
125+
}
126+
112127
/**
113128
* Helps with hash maps collisions. Should be consistent with equals.
114129
*/

0 commit comments

Comments
 (0)