Skip to content

Commit

Permalink
HV-1691 Rename PathImpl#getPathWithoutLeafNode to createCopyWithoutLe…
Browse files Browse the repository at this point in the history
…afNode

And make it static to be more consistent with createCopy().
  • Loading branch information
gsmet committed Feb 18, 2019
1 parent 84fd732 commit 571ab96
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Expand Up @@ -1277,7 +1277,7 @@ private boolean isReachable(BaseBeanValidationContext<?> validationContext, Obje
return true;
}

Path pathToObject = path.getPathWithoutLeafNode();
Path pathToObject = PathImpl.createCopyWithoutLeafNode( path );
try {
return validationContext.getTraversableResolver().isReachable(
traversableObject,
Expand Down Expand Up @@ -1314,7 +1314,7 @@ private boolean isCascadeRequired(BaseBeanValidationContext<?> validationContext
return false;
}

Path pathToObject = path.getPathWithoutLeafNode();
Path pathToObject = PathImpl.createCopyWithoutLeafNode( path );
try {
return validationContext.getTraversableResolver().isCascadable(
traversableObject,
Expand Down
Expand Up @@ -247,7 +247,7 @@ public ContainerElementNodeBuilderCustomizableContext addContainerElementNode(St
*/
private void dropLeafNodeIfRequired() {
if ( propertyPath.getLeafNode().getKind() == ElementKind.BEAN ) {
propertyPath = propertyPath.getPathWithoutLeafNode();
propertyPath = PathImpl.createCopyWithoutLeafNode( propertyPath );
}
}
}
Expand Down
Expand Up @@ -70,7 +70,7 @@ public NodeBuilderDefinedContext addParameterNode(int index) {
}

private void dropLeafNode() {
propertyPath = propertyPath.getPathWithoutLeafNode();
propertyPath = PathImpl.createCopyWithoutLeafNode( propertyPath );
}
}
}
Expand Up @@ -105,12 +105,13 @@ public static PathImpl createCopy(PathImpl path) {
return new PathImpl( path );
}

public boolean isRootPath() {
return nodeList.size() == 1 && nodeList.get( 0 ).getName() == null;
public static PathImpl createCopyWithoutLeafNode(PathImpl path) {
return new PathImpl( path.nodeList.subList( 0, path.nodeList.size() - 1 ) );
}

public PathImpl getPathWithoutLeafNode() {
return new PathImpl( nodeList.subList( 0, nodeList.size() - 1 ) );

public boolean isRootPath() {
return nodeList.size() == 1 && nodeList.get( 0 ).getName() == null;
}

public NodeImpl addPropertyNode(String nodeName) {
Expand Down

0 comments on commit 571ab96

Please sign in to comment.