summaryrefslogtreecommitdiffstats
path: root/cps-service/src/main/java/org/onap/cps/spi/model/DataNodeBuilder.java
diff options
context:
space:
mode:
Diffstat (limited to 'cps-service/src/main/java/org/onap/cps/spi/model/DataNodeBuilder.java')
-rw-r--r--cps-service/src/main/java/org/onap/cps/spi/model/DataNodeBuilder.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/cps-service/src/main/java/org/onap/cps/spi/model/DataNodeBuilder.java b/cps-service/src/main/java/org/onap/cps/spi/model/DataNodeBuilder.java
index d187f62e0..67e93dd82 100644
--- a/cps-service/src/main/java/org/onap/cps/spi/model/DataNodeBuilder.java
+++ b/cps-service/src/main/java/org/onap/cps/spi/model/DataNodeBuilder.java
@@ -1,6 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 Pantheon.tech
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,6 +43,7 @@ public class DataNodeBuilder {
private NormalizedNode<?, ?> normalizedNodeTree;
private String xpath;
+ private Map<String, Object> leaves = Collections.emptyMap();
private Collection<DataNode> childDataNodes = Collections.emptySet();
@@ -68,6 +70,17 @@ public class DataNodeBuilder {
}
/**
+ * To use attributes for creating {@link DataNode}.
+ *
+ * @param leaves for the data node
+ * @return DataNodeBuilder
+ */
+ public DataNodeBuilder withLeaves(final Map<String, Object> leaves) {
+ this.leaves = leaves;
+ return this;
+ }
+
+ /**
* To specify child nodes needs to be used while creating {@link DataNode}.
*
* @param childDataNodes to be added to the dataNode
@@ -96,6 +109,7 @@ public class DataNodeBuilder {
private DataNode buildFromAttributes() {
final DataNode dataNode = new DataNode();
dataNode.setXpath(xpath);
+ dataNode.setLeaves(leaves);
dataNode.setChildDataNodes(childDataNodes);
return dataNode;
}