a59a46bc30a56f515243536f3b91ca1699c4a635
[yangtools.git] / binding / binding-ri / 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.yangtools.binding.contract.StatementNamespace;
12 import org.opendaylight.yangtools.binding.model.api.Type;
13 import org.opendaylight.yangtools.binding.runtime.api.LeafRuntimeType;
14 import org.opendaylight.yangtools.yang.model.api.stmt.LeafEffectiveStatement;
15
16 /**
17  * Generator corresponding to a {@code leaf} statement.
18  */
19 final class LeafGenerator extends AbstractTypeAwareGenerator<LeafEffectiveStatement, LeafRuntimeType, LeafGenerator> {
20     LeafGenerator(final LeafEffectiveStatement statement, final AbstractCompositeGenerator<?, ?> parent) {
21         super(statement, parent);
22     }
23
24     @Override
25     StatementNamespace namespace() {
26         return StatementNamespace.LEAF;
27     }
28
29     @Override
30     LeafRuntimeType createExternalRuntimeType(final Type type) {
31         return new DefaultLeafRuntimeType(type, statement());
32     }
33
34     @Override
35     LeafRuntimeType createInternalRuntimeType(final AugmentResolver resolver, final LeafEffectiveStatement statement,
36             final Type type) {
37         return new DefaultLeafRuntimeType(type, statement);
38     }
39 }