Move EffectiveStatementMixins to yang-model-spi
[yangtools.git] / yang / yang-parser-rfc7950 / src / main / java / org / opendaylight / yangtools / yang / parser / rfc7950 / stmt / deviation / DeviationEffectiveStatementImpl.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.rfc7950.stmt.deviation;
9
10 import com.google.common.collect.ImmutableList;
11 import java.util.Collection;
12 import org.opendaylight.yangtools.yang.model.api.DeviateDefinition;
13 import org.opendaylight.yangtools.yang.model.api.Deviation;
14 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
15 import org.opendaylight.yangtools.yang.model.api.stmt.DeviationEffectiveStatement;
16 import org.opendaylight.yangtools.yang.model.api.stmt.DeviationStatement;
17 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
18 import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
19 import org.opendaylight.yangtools.yang.model.spi.meta.EffectiveStatementMixins.DocumentedNodeMixin;
20
21 final class DeviationEffectiveStatementImpl extends WithSubstatements<Absolute, DeviationStatement>
22         implements DeviationEffectiveStatement, Deviation, DocumentedNodeMixin<Absolute, DeviationStatement> {
23     DeviationEffectiveStatementImpl(final DeviationStatement declared,
24             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
25         super(declared, substatements);
26     }
27
28     @Override
29     public Collection<? extends DeviateDefinition> getDeviates() {
30         return filterEffectiveStatements(DeviateDefinition.class);
31     }
32
33     @Override
34     public DeviationEffectiveStatement asEffectiveStatement() {
35         return this;
36     }
37
38     @Override
39     public String toString() {
40         return DeviationEffectiveStatementImpl.class.getSimpleName() + "["
41                 + "targetPath=" + getTargetPath()
42                 + ", deviates=" + getDeviates()
43                 + ", description=" + getDescription().orElse(null)
44                 + ", reference=" + getReference().orElse(null)
45                 + "]";
46     }
47 }