Reformulate StatementContextFactory.createEffective()
[yangtools.git] / yang / yang-parser-spi / src / main / java / org / opendaylight / yangtools / yang / parser / spi / meta / StatementFactory.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.parser.spi.meta;
9
10 import java.util.stream.Stream;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
13 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
14
15 /**
16  * An entity capable of creating {@link DeclaredStatement} and {@link EffectiveStatement} instances for a particular
17  * type. This interface is usually realized as an implementation-specific combination with {@link StatementSupport}.
18  *
19  * @param <A> Argument type
20  * @param <D> Declared Statement representation
21  * @param <E> Effective Statement representation
22  */
23 public interface StatementFactory<A, D extends DeclaredStatement<A>, E extends EffectiveStatement<A, D>> {
24     /**
25      * Create a {@link DeclaredStatement} for specified context.
26      *
27      * @param ctx Statement context
28      * @return A declared statement instance.
29      */
30     @NonNull D createDeclared(@NonNull StmtContext<A, D, ?> ctx);
31
32     /**
33      * Create a {@link EffectiveStatement} for specified context.
34      *
35      * @param stmt Effective capture of this statement's significant state
36      * @return An effective statement instance
37      */
38     @NonNull E createEffective(EffectiveStmtCtx.@NonNull Current<A, D> stmt,
39         Stream<? extends StmtContext<?, ?, ?>> declaredSubstatements,
40         Stream<? extends StmtContext<?, ?, ?>> effectiveSubstatements);
41 }