Skip to content

Commit

Permalink
HV-1480 Only set the property value if required
Browse files Browse the repository at this point in the history
Only property and container node exposes it to users.
  • Loading branch information
gsmet committed Sep 11, 2017
1 parent 491ec28 commit 49b6bf5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Expand Up @@ -192,7 +192,7 @@ public final void setCurrentGroup(Class<?> currentGroup) {
}

public final void setCurrentValidatedValue(V currentValue) {
propertyPath.setLeafNodeValue( currentValue );
propertyPath.setLeafNodeValueIfRequired( currentValue );
this.currentValue = currentValue;
}

Expand Down
Expand Up @@ -222,13 +222,16 @@ public NodeImpl makeLeafNodeIterableAndSetMapKey(Object key) {
return currentLeafNode;
}

public NodeImpl setLeafNodeValue(Object value) {
requiresWriteableNodeList();
public NodeImpl setLeafNodeValueIfRequired(Object value) {
// The value is only exposed for property and container element nodes
if ( currentLeafNode.getKind() == ElementKind.PROPERTY || currentLeafNode.getKind() == ElementKind.CONTAINER_ELEMENT ) {
requiresWriteableNodeList();

currentLeafNode = NodeImpl.setPropertyValue( currentLeafNode, value );
currentLeafNode = NodeImpl.setPropertyValue( currentLeafNode, value );

nodeList.set( nodeList.size() - 1, currentLeafNode );
hashCode = -1;
nodeList.set( nodeList.size() - 1, currentLeafNode );
hashCode = -1;
}
return currentLeafNode;
}

Expand Down

0 comments on commit 49b6bf5

Please sign in to comment.