package org.opendaylight.yangtools.yang.data.api;
import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Verify.verifyNotNull;
import static java.util.Objects.requireNonNull;
import com.google.common.collect.ImmutableList;
return ret;
}
+ @Override
+ public YangInstanceIdentifier coerceParent() {
+ return verifyNotNull(getParent(), "Empty instance identifier does not have a parent");
+ }
+
@Override
public YangInstanceIdentifier getAncestor(final int depth) {
checkArgument(depth >= 0, "Negative depth is not allowed");
import static java.util.Objects.requireNonNull;
import com.google.common.annotations.Beta;
+import com.google.common.base.VerifyException;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
*/
public abstract @Nullable YangInstanceIdentifier getParent();
+ /**
+ * Return the conceptual parent {@link YangInstanceIdentifier}, which has one item less in
+ * {@link #getPathArguments()}.
+ *
+ * @return Parent {@link YangInstanceIdentifier}
+ * @throws VerifyException if this object is {@link #empty()}.
+ */
+ public abstract @NonNull YangInstanceIdentifier coerceParent();
+
/**
* Return the ancestor {@link YangInstanceIdentifier} with a particular depth, e.g. number of path arguments.
*