*/
package org.opendaylight.mdsal.binding.generator.impl.reactor;
+import java.util.List;
+import org.opendaylight.mdsal.binding.generator.impl.rt.DefaultNotificationRuntimeType;
import org.opendaylight.mdsal.binding.model.api.GeneratedType;
import org.opendaylight.mdsal.binding.model.api.Type;
import org.opendaylight.mdsal.binding.model.api.type.builder.GeneratedTypeBuilder;
import org.opendaylight.mdsal.binding.model.api.type.builder.GeneratedTypeBuilderBase;
import org.opendaylight.mdsal.binding.model.ri.BindingTypes;
+import org.opendaylight.mdsal.binding.runtime.api.AugmentRuntimeType;
+import org.opendaylight.mdsal.binding.runtime.api.NotificationRuntimeType;
+import org.opendaylight.mdsal.binding.runtime.api.RuntimeType;
import org.opendaylight.yangtools.yang.model.api.stmt.NotificationEffectiveStatement;
import org.opendaylight.yangtools.yang.model.util.SchemaInferenceStack;
/**
* Generator corresponding to a {@code notification} statement.
*/
-final class NotificationGenerator extends AbstractCompositeGenerator<NotificationEffectiveStatement> {
- NotificationGenerator(final NotificationEffectiveStatement statement, final AbstractCompositeGenerator<?> parent) {
+final class NotificationGenerator
+ extends CompositeSchemaTreeGenerator<NotificationEffectiveStatement, NotificationRuntimeType> {
+ NotificationGenerator(final NotificationEffectiveStatement statement,
+ final AbstractCompositeGenerator<?, ?> parent) {
super(statement, parent);
}
final ModuleGenerator module = currentModule();
module.addQNameConstant(builder, localName());
- addCodegenInformation(module, statement(), builder);
+ builderFactory.addCodegenInformation(module, statement(), builder);
annotateDeprecatedIfNecessary(builder);
return builder.build();
// Notifications are a distinct concept
}
+ @Override
+ CompositeRuntimeTypeBuilder<NotificationEffectiveStatement, NotificationRuntimeType> createBuilder(
+ final NotificationEffectiveStatement statement) {
+ return new CompositeRuntimeTypeBuilder<>(statement) {
+ @Override
+ NotificationRuntimeType build(final GeneratedType type, final NotificationEffectiveStatement statement,
+ final List<RuntimeType> children, final List<AugmentRuntimeType> augments) {
+ return new DefaultNotificationRuntimeType(type, statement, children, augments);
+ }
+ };
+ }
+
private Type notificationType(final GeneratedTypeBuilder builder, final TypeBuilderFactory builderFactory) {
- final AbstractCompositeGenerator<?> parent = getParent();
+ final AbstractCompositeGenerator<?, ?> parent = getParent();
if (parent instanceof ModuleGenerator) {
- return BindingTypes.NOTIFICATION;
+ return BindingTypes.notification(builder);
}
final Type parentType = Type.of(parent.typeName());