2 * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.model.spi;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.annotations.Beta;
13 import com.google.common.base.MoreObjects.ToStringHelper;
14 import com.google.common.collect.ImmutableList;
15 import java.util.List;
16 import org.eclipse.jdt.annotation.NonNull;
17 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
18 import org.opendaylight.yangtools.yang.model.api.EffectiveStatementInference;
19 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
22 * A simple capture of an {@link AbstractEffectiveModelContextProvider} and {@link EffectiveStatementInference}s.
24 * @param T constituent {@link EffectiveStatement} type
27 public abstract class AbstractEffectiveStatementInference<T extends EffectiveStatement<?, ?>>
28 extends AbstractEffectiveModelContextProvider implements EffectiveStatementInference {
29 protected AbstractEffectiveStatementInference(final @NonNull EffectiveModelContext modelContext) {
34 public abstract List<T> statementPath();
37 * A simple capture of an {@link AbstractEffectiveStatementInference} and a list of {@link EffectiveStatement}s. No
38 * further guarantees are made.
40 * @param T constituent {@link EffectiveStatement} type
43 public abstract static class WithPath<T extends EffectiveStatement<?, ?>>
44 extends AbstractEffectiveStatementInference<T> {
45 private final @NonNull List<T> path;
47 protected WithPath(final @NonNull EffectiveModelContext modelContext, final @NonNull ImmutableList<T> path) {
49 this.path = requireNonNull(path);
52 protected WithPath(final @NonNull EffectiveModelContext modelContext, final @NonNull List<? extends T> path) {
54 this.path = ImmutableList.copyOf(path);
58 public final List<T> statementPath() {
63 protected ToStringHelper addToStringAttributes(final ToStringHelper helper) {
64 return super.addToStringAttributes(helper).add("path", path);