233b785917f4b725c52fb64acbc78f526555efc4
[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     LeafRuntimeType createExternalRuntimeType(final Type type) {
25         return new DefaultLeafRuntimeType(type, statement());
26     }
27
28     @Override
29     LeafRuntimeType createInternalRuntimeType(final ChildLookup lookup, final LeafEffectiveStatement statement,
30             final Type type) {
31         return new DefaultLeafRuntimeType(type, statement);
32     }
33 }