Remove hashCode()/equals() from SchemaNode implementations
[yangtools.git] / yang / yang-parser-rfc7950 / src / main / java / org / opendaylight / yangtools / yang / parser / rfc7950 / stmt / notification / NotificationEffectiveStatementImpl.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.notification;
9
10 import com.google.common.collect.ImmutableList;
11 import java.util.Optional;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
15 import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
16 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
17 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
18 import org.opendaylight.yangtools.yang.model.api.stmt.NotificationEffectiveStatement;
19 import org.opendaylight.yangtools.yang.model.api.stmt.NotificationStatement;
20 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredEffectiveStatement.DefaultWithDataTree.WithSubstatements;
21 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.EffectiveStatementMixins.AugmentationTargetMixin;
22 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.EffectiveStatementMixins.CopyableMixin;
23 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.EffectiveStatementMixins.DataNodeContainerMixin;
24 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.EffectiveStatementMixins.MustConstraintMixin;
25 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.EffectiveStatementMixins.SchemaNodeMixin;
26 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
27
28 final class NotificationEffectiveStatementImpl
29         extends WithSubstatements<QName, NotificationStatement, NotificationEffectiveStatement>
30         implements NotificationDefinition, NotificationEffectiveStatement,
31                    SchemaNodeMixin<QName, NotificationStatement>, DataNodeContainerMixin<QName, NotificationStatement>,
32                    AugmentationTargetMixin<QName, NotificationStatement>, CopyableMixin<QName, NotificationStatement>,
33                    MustConstraintMixin<QName, NotificationStatement> {
34
35     private final @NonNull SchemaPath path;
36     private final int flags;
37
38     NotificationEffectiveStatementImpl(final NotificationStatement declared, final int flags,
39             final StmtContext<QName, NotificationStatement, NotificationEffectiveStatement> ctx,
40             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
41         super(declared, ctx, substatements);
42         this.path = ctx.getSchemaPath().get();
43         this.flags = flags;
44     }
45
46     @Override
47     public @NonNull QName argument() {
48         return getQName();
49     }
50
51     @Override
52     public Optional<DataSchemaNode> findDataChildByName(final QName name) {
53         return findDataSchemaNode(name);
54     }
55
56     @Override
57     public int flags() {
58         return flags;
59     }
60
61     @Override
62     public SchemaPath getPath() {
63         return path;
64     }
65
66     @Override
67     public String toString() {
68         return NotificationEffectiveStatementImpl.class.getSimpleName() + "[qname=" + getQName() + ", path=" + path
69                 + "]";
70     }
71 }