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 EffectiveModelContext} and a list of {@link EffectiveStatement}s. No further guarantees
25 * @param T constituent {@link EffectiveStatement} type
28 public abstract class AbstractEffectiveStatementInference<T extends EffectiveStatement<?, ?>>
29 extends AbstractEffectiveModelContextProvider implements EffectiveStatementInference {
30 private final @NonNull List<T> path;
32 protected AbstractEffectiveStatementInference(final @NonNull EffectiveModelContext modelContext,
33 final @NonNull ImmutableList<T> path) {
35 this.path = requireNonNull(path);
38 protected AbstractEffectiveStatementInference(final @NonNull EffectiveModelContext modelContext,
39 final @NonNull List<? extends T> path) {
41 this.path = ImmutableList.copyOf(path);
45 public final List<T> statementPath() {
50 protected ToStringHelper addToStringAttributes(final ToStringHelper helper) {
51 return super.addToStringAttributes(helper).add("statements", path);