bac8144ff5f252da8486441d81ec9567c33c66ba
[mdsal.git] / binding / mdsal-binding-generator / src / main / java / org / opendaylight / mdsal / binding / generator / impl / reactor / LeafGenerator.java
1 /*
2  * Copyright (c) 2021 PANTHEON.tech, s.r.o. 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.mdsal.binding.generator.impl.reactor;
9
10 import org.opendaylight.mdsal.binding.generator.impl.rt.DefaultLeafRuntimeType;
11 import org.opendaylight.mdsal.binding.model.api.Type;
12 import org.opendaylight.mdsal.binding.runtime.api.LeafRuntimeType;
13 import org.opendaylight.yangtools.yang.model.api.stmt.LeafEffectiveStatement;
14
15 /**
16  * Generator corresponding to a {@code leaf} statement.
17  */
18 final class LeafGenerator extends AbstractTypeAwareGenerator<LeafEffectiveStatement, LeafRuntimeType, LeafGenerator> {
19     LeafGenerator(final LeafEffectiveStatement statement, final AbstractCompositeGenerator<?, ?> parent) {
20         super(statement, parent);
21     }
22
23     @Override
24     StatementNamespace namespace() {
25         return StatementNamespace.LEAF;
26     }
27
28     @Override
29     LeafRuntimeType createExternalRuntimeType(final Type type) {
30         return new DefaultLeafRuntimeType(type, statement());
31     }
32
33     @Override
34     LeafRuntimeType createInternalRuntimeType(final AugmentResolver resolver, final LeafEffectiveStatement statement,
35             final Type type) {
36         return new DefaultLeafRuntimeType(type, statement);
37     }
38 }