Add SchemaTreeInference
[yangtools.git] / yang / yang-model-spi / src / main / java / org / opendaylight / yangtools / yang / model / spi / AbstractEffectiveStatementInference.java
index 529f058fd1c68995a2dc778fefa1bc76aff6c1e3..8dd25e29e01e5f545e97e8c152276b16cc503a09 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.yangtools.yang.model.spi;
 import static java.util.Objects.requireNonNull;
 
 import com.google.common.annotations.Beta;
+import com.google.common.base.MoreObjects.ToStringHelper;
 import com.google.common.collect.ImmutableList;
 import java.util.List;
 import org.eclipse.jdt.annotation.NonNull;
@@ -18,27 +19,35 @@ import org.opendaylight.yangtools.yang.model.api.EffectiveStatementInference;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 
 /**
- * A simple capture of an {@link EffectiveModelContext} and a list of paths. No further guarantees are made.
+ * A simple capture of an {@link EffectiveModelContext} and a list of {@link EffectiveStatement}s. No further guarantees
+ * are made.
+ *
+ * @param T constituent {@link EffectiveStatement} type
  */
 @Beta
-public abstract class AbstractEffectiveStatementInference extends AbstractEffectiveModelContextProvider
-        implements EffectiveStatementInference {
-    private final @NonNull List<EffectiveStatement<?, ?>> path;
+public abstract class AbstractEffectiveStatementInference<T extends EffectiveStatement<?, ?>>
+        extends AbstractEffectiveModelContextProvider implements EffectiveStatementInference {
+    private final @NonNull List<T> path;
 
     protected AbstractEffectiveStatementInference(final @NonNull EffectiveModelContext modelContext,
-            final @NonNull ImmutableList<EffectiveStatement<?, ?>> path) {
+            final @NonNull ImmutableList<T> path) {
         super(modelContext);
         this.path = requireNonNull(path);
     }
 
     protected AbstractEffectiveStatementInference(final @NonNull EffectiveModelContext modelContext,
-            final @NonNull List<? extends EffectiveStatement<?, ?>> path) {
+            final @NonNull List<? extends T> path) {
         super(modelContext);
         this.path = ImmutableList.copyOf(path);
     }
 
     @Override
-    public final List<EffectiveStatement<?, ?>> statementPath() {
+    public final List<T> statementPath() {
         return path;
     }
+
+    @Override
+    protected ToStringHelper addToStringAttributes(final ToStringHelper helper) {
+        return super.addToStringAttributes(helper).add("statements", path);
+    }
 }