final TypeEffectiveStatement<?> type, final boolean isTypedef, final TypeDefinition<?> typedef) {
final GeneratedUnionBuilder builder = builderFactory.newGeneratedUnionBuilder(typeName);
YangSourceDefinition.of(module.statement(), definingStatement).ifPresent(builder::setYangSourceDefinition);
- builder.addImplementsType(BindingTypes.TYPE_OBJECT);
+ builder.addImplementsType(BindingTypes.UNION_TYPE_OBJECT);
builder.setIsUnion(true);
// builder.setSchemaPath(typedef.getPath());
public final class SerialVersionHelper {
private static final Set<ConcreteType> IGNORED_INTERFACES =
- Set.of(BindingTypes.TYPE_OBJECT, BindingTypes.SCALAR_TYPE_OBJECT);
+ Set.of(BindingTypes.BITS_TYPE_OBJECT, BindingTypes.SCALAR_TYPE_OBJECT, BindingTypes.UNION_TYPE_OBJECT);
private static final Comparator<TypeMemberBuilder<?>> SUID_MEMBER_COMPARATOR =
Comparator.comparing(TypeMemberBuilder::getName);
private static final Comparator<Type> SUID_NAME_COMPARATOR = Comparator.comparing(Type::getFullyQualifiedName);
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.opendaylight.mdsal.binding.model.ri.BindingTypes.BITS_TYPE_OBJECT;
-import static org.opendaylight.mdsal.binding.model.ri.BindingTypes.TYPE_OBJECT;
+import static org.opendaylight.mdsal.binding.model.ri.BindingTypes.UNION_TYPE_OBJECT;
import java.util.List;
import org.junit.AfterClass;
assertNotNull(typedefType.getImplements());
Type objectType = typedefType.getImplements().stream()
.filter(type -> type.getFullyQualifiedName()
- .equals("org.opendaylight.yangtools.yang.binding.TypeObject")).findAny().get();
- assertEquals(TYPE_OBJECT, objectType);
+ .equals("org.opendaylight.yangtools.yang.binding.UnionTypeObject")).findAny().get();
+ assertEquals(UNION_TYPE_OBJECT, objectType);
}
}
CompilationTestUtils.assertContainsField(bitsExtClass, "_sfmof", boolean.class);
CompilationTestUtils.assertContainsField(bitsExtClass, "_sfapc", boolean.class);
CompilationTestUtils.assertContainsFieldWithValue(bitsExtClass, "serialVersionUID", Long.TYPE,
- 7934653360983102096L, boolean.class, boolean.class, boolean.class, boolean.class, boolean.class,
+ -2922917845344851623L, boolean.class, boolean.class, boolean.class, boolean.class, boolean.class,
boolean.class, boolean.class);
assertEquals(9, bitsExtClass.getDeclaredFields().length);
requires transitive org.opendaylight.mdsal.binding.model.api;
requires org.opendaylight.mdsal.binding.spec.util;
requires org.opendaylight.yangtools.util;
+ requires org.opendaylight.yangtools.yang.binding;
requires org.opendaylight.yangtools.yang.common;
requires org.opendaylight.yangtools.yang.model.api;
requires org.opendaylight.yangtools.yang.model.ri;
import org.opendaylight.yangtools.yang.binding.RpcOutput;
import org.opendaylight.yangtools.yang.binding.RpcService;
import org.opendaylight.yangtools.yang.binding.ScalarTypeObject;
-import org.opendaylight.yangtools.yang.binding.TypeObject;
+import org.opendaylight.yangtools.yang.binding.UnionTypeObject;
import org.opendaylight.yangtools.yang.binding.YangFeature;
import org.opendaylight.yangtools.yang.binding.annotations.RoutingContext;
import org.opendaylight.yangtools.yang.common.QName;
public static final ConcreteType BASE_IDENTITY = typeForClass(BaseIdentity.class);
public static final ConcreteType DATA_CONTAINER = typeForClass(DataContainer.class);
public static final ConcreteType DATA_OBJECT = typeForClass(DataObject.class);
- public static final ConcreteType TYPE_OBJECT = typeForClass(TypeObject.class);
public static final ConcreteType DATA_ROOT = typeForClass(DataRoot.class);
@Deprecated(since = "10.0.0", forRemoval = true)
public static final ConcreteType NOTIFICATION_LISTENER = typeForClass(NotificationListener.class);
public static final ConcreteType RPC_SERVICE = typeForClass(RpcService.class);
public static final ConcreteType SCALAR_TYPE_OBJECT = typeForClass(ScalarTypeObject.class);
public static final ConcreteType BITS_TYPE_OBJECT = typeForClass(BitsTypeObject.class);
+ public static final ConcreteType UNION_TYPE_OBJECT = typeForClass(UnionTypeObject.class);
public static final ConcreteType INSTANCE_IDENTIFIER = typeForClass(InstanceIdentifier.class);
public static final ConcreteType KEYED_INSTANCE_IDENTIFIER = typeForClass(KeyedInstanceIdentifier.class);
/**
* Interface implemented by all {@link TypeObject}s generated for {@code type bits}.
*/
-public interface BitsTypeObject extends TypeObject {
+public non-sealed interface BitsTypeObject extends TypeObject {
/**
* Return the set of strings which are valid {@code bit} names for this type. The iteration order of the returned
* set is required to match effective bit {@code position} assignment.
*
* @author Robert Varga
*/
-public interface Enumeration extends TypeObject {
+// FIXME: 12.0.0: rename to EnumTypeObject
+public non-sealed interface Enumeration extends TypeObject {
/**
* Returns the assigned name of the enumeration item as it is specified in the input YANG.
*
*
* @author Jie Han
*/
-public non-sealed interface TypeObject extends BindingObject {
+public sealed interface TypeObject extends BindingObject
+ permits BitsTypeObject, Enumeration, ScalarTypeObject, UnionTypeObject {
+
}
--- /dev/null
+/*
+ * Copyright (c) 2022 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.binding;
+
+/**
+ * A {@link TypeObject} corresponding to a {@code type union}.
+ */
+public non-sealed interface UnionTypeObject extends TypeObject {
+
+}