* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
+
package org.opendaylight.yangtools.yang.parser.spi.meta;
+import com.google.common.base.Function;
import com.google.common.base.Predicates;
import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
import org.opendaylight.yangtools.yang.model.api.meta.StatementSource;
+import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase;
/**
* Utility abstract base class for implementing declared statements.
* Perform an explicit copy, because Collections2.transform() is lazily transformed and retains pointer to
* original collection, which may contains references to mutable context.
*/
- substatements = ImmutableList.copyOf(Collections2.transform(context.declaredSubstatements(),
- StmtContextUtils.buildDeclared()));
+ Collection<StatementContextBase<?, ?, ?>> declaredSubstatements = context.declaredSubstatements();
+ Function<StmtContext<?, ? extends DeclaredStatement<?>, ?>, DeclaredStatement<?>> buildDeclared = StmtContextUtils.buildDeclared();
+ substatements = ImmutableList.copyOf(Collections2.transform(declaredSubstatements, buildDeclared));
}
protected final <S extends DeclaredStatement<?>> S firstDeclared(final Class<S> type) {
*/
package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
this.unknownSubstatementsToBuild = ImmutableList.of();
}
- this.substatements = ImmutableList.copyOf(Collections2.transform(substatementsToBuild,
- StmtContextUtils.buildEffective()));
+ Function<StmtContext<?, ?, ? extends EffectiveStatement<?, ?>>, EffectiveStatement<?, ?>> buildEffective = StmtContextUtils.buildEffective();
+ this.substatements = ImmutableList.copyOf(Collections2.transform(substatementsToBuild, buildEffective));
}
Collection<EffectiveStatement<?, ?>> getOmittedUnknownSubstatements() {
- return Collections2.transform(unknownSubstatementsToBuild,
- StmtContextUtils.buildEffective());
+ Function<StmtContext<?, ?, ? extends EffectiveStatement<?, ?>>, EffectiveStatement<?, ?>> buildEffective = StmtContextUtils.buildEffective();
+ return Collections2.transform(unknownSubstatementsToBuild, buildEffective);
}
@Override