From: Robert Varga Date: Mon, 28 Sep 2015 08:39:06 +0000 (+0200) Subject: Use SchemaPath.getParent() X-Git-Tag: release/beryllium~255 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=8531f3a6f276ea024219835d9996a4049c8f539d;p=yangtools.git Use SchemaPath.getParent() Creating a parent SchemaPath is simple, no need to fork them. Change-Id: I6c93e6a913fa582f8cd615deb992738f22afe0e0 Signed-off-by: Robert Varga --- diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/CaseShorthandImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/CaseShorthandImpl.java index e5aec1f447..f72fc22b01 100644 --- a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/CaseShorthandImpl.java +++ b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/CaseShorthandImpl.java @@ -8,8 +8,8 @@ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective; import com.google.common.base.Optional; +import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; -import com.google.common.collect.Iterables; import java.util.Arrays; import java.util.Collection; import java.util.Collections; @@ -43,22 +43,13 @@ public class CaseShorthandImpl implements ChoiceCaseNode, DerivableSchemaNode { private final boolean augmenting; private final boolean addedByUses; private final ConstraintDefinition constraints; + private final List unknownNodes; private ChoiceCaseNode original; - ImmutableList unknownNodes; - public CaseShorthandImpl(final DataSchemaNode caseShorthandNode) { this.caseShorthandNode = caseShorthandNode; this.qName = caseShorthandNode.getQName(); - - SchemaPath caseShorthandNodePath = caseShorthandNode.getPath(); - Iterable pathFromRoot = caseShorthandNodePath.getPathFromRoot(); - // FIXME: cacheShorthandNodePath.getParent() should be enough - this.path = SchemaPath - .create(Iterables.limit(pathFromRoot, - Iterables.size(pathFromRoot) - 1), - caseShorthandNodePath.isAbsolute()); - + this.path = Preconditions.checkNotNull(caseShorthandNode.getPath().getParent()); this.description = caseShorthandNode.getDescription(); this.reference = caseShorthandNode.getReference(); this.status = caseShorthandNode.getStatus();