import org.opendaylight.yangtools.sal.binding.model.api.type.builder.MethodSignatureBuilder;
import org.opendaylight.yangtools.sal.binding.yang.types.GroupingDefinitionDependencySort;
import org.opendaylight.yangtools.sal.binding.yang.types.TypeProviderImpl;
+import org.opendaylight.yangtools.yang.binding.Augmentable;
import org.opendaylight.yangtools.yang.binding.DataRoot;
import org.opendaylight.yangtools.yang.binding.Identifiable;
import org.opendaylight.yangtools.yang.binding.Identifier;
import org.opendaylight.yangtools.yang.model.util.ExtendedType;
import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
import org.opendaylight.yangtools.yang.model.util.UnionType;
+import static org.opendaylight.yangtools.binding.generator.util.Types.*;
+import static org.opendaylight.yangtools.binding.generator.util.BindingTypes.*;
+
import com.google.common.base.Preconditions;
import com.google.common.base.Predicates;
rpcInOut.add(new DataNodeIterator(input));
GeneratedTypeBuilder inType = addRawInterfaceDefinition(basePackageName, input, rpcName);
addImplementedInterfaceFromUses(input, inType);
- inType.addImplementsType(Types.DATA_OBJECT);
+ inType.addImplementsType(DATA_OBJECT);
+ inType.addImplementsType(augmentable(inType));
resolveDataSchemaNodes(basePackageName, inType, input.getChildNodes());
Type inTypeInstance = inType.toInstance();
genRPCTypes.add(inTypeInstance);
rpcInOut.add(new DataNodeIterator(output));
GeneratedTypeBuilder outType = addRawInterfaceDefinition(basePackageName, output, rpcName);
addImplementedInterfaceFromUses(output, outType);
- outType.addImplementsType(Types.DATA_OBJECT);
+ outType.addImplementsType(DATA_OBJECT);
+ outType.addImplementsType(augmentable(outType));
+
resolveDataSchemaNodes(basePackageName, outType, output.getChildNodes());
outTypeInstance = outType.toInstance();
genRPCTypes.add(outTypeInstance);
final GeneratedTypeBuilder augTypeBuilder = new GeneratedTypeBuilderImpl(augmentPackageName, augTypeName);
- augTypeBuilder.addImplementsType(Types.DATA_OBJECT);
+ augTypeBuilder.addImplementsType(DATA_OBJECT);
augTypeBuilder.addImplementsType(Types.augmentationTypeFor(targetTypeRef));
addImplementedInterfaceFromUses(augSchema, augTypeBuilder);
final List<GeneratedType> generatedTypes = new ArrayList<>();
final String packageName = packageNameForGeneratedType(basePackageName, choiceNode.getPath());
final GeneratedTypeBuilder choiceTypeBuilder = addRawInterfaceDefinition(packageName, choiceNode);
- choiceTypeBuilder.addImplementsType(Types.DATA_OBJECT);
+ choiceTypeBuilder.addImplementsType(DATA_OBJECT);
final GeneratedType choiceType = choiceTypeBuilder.toInstance();
generatedTypes.add(choiceType);
*/
private GeneratedTypeBuilder addDefaultInterfaceDefinition(final String packageName, final SchemaNode schemaNode) {
final GeneratedTypeBuilder builder = addRawInterfaceDefinition(packageName, schemaNode, "");
- builder.addImplementsType(Types.DATA_OBJECT);
+ builder.addImplementsType(DATA_OBJECT);
if (!(schemaNode instanceof GroupingDefinition)) {
- builder.addImplementsType(Types.augmentableTypeFor(builder));
+ builder.addImplementsType(augmentable(builder));
}
if (schemaNode instanceof DataNodeContainer) {
final Type javaType) {
if (javaType != null) {
final String typedefName = typedef.getQName().getLocalName();
- final String propertyName = parseToValidParamName(typedefName);
+ final String propertyName = "value";
final GeneratedTOBuilder genTOBuilder = typedefToTransferObject(basePackageName, typedef);
properties = extendTO.getProperties();
assertEquals("Incorrect number of properties in class SimpleTypedef1.", 1, properties.size());
- assertEquals("Incorrect property's name", "simpleTypedef1", properties.get(0).getName());
+ assertEquals("Incorrect property's name", "value", properties.get(0).getName());
assertEquals("Property's incorrect type", BaseYangTypes.UINT8_TYPE, properties.get(0).getReturnType());
extendTO = extendTO.getExtends();
--- /dev/null
+package org.opendaylight.yangtools.binding.generator.util;
+
+import org.opendaylight.yangtools.sal.binding.model.api.ConcreteType;
+import org.opendaylight.yangtools.sal.binding.model.api.ParameterizedType;
+import org.opendaylight.yangtools.sal.binding.model.api.Type;
+import org.opendaylight.yangtools.yang.binding.*;
+import static org.opendaylight.yangtools.binding.generator.util.Types.*;
+public class BindingTypes {
+
+ public static final ConcreteType AUGMENTABLE = typeForClass(Augmentable.class);
+ public static final ConcreteType AUGMENTATION = typeForClass(Augmentation.class);
+ public static final ConcreteType BASE_IDENTITY = typeForClass(BaseIdentity.class);
+ public static final ConcreteType DATA_OBJECT = typeForClass(DataObject.class);
+ public static final ConcreteType DATA_ROOT = typeForClass(DataRoot.class);
+ public static final ConcreteType IDENTIFIABLE = typeForClass(Identifiable.class);
+ public static final ConcreteType IDENTIFIER = typeForClass(Identifier.class);
+ public static final ConcreteType INSTANCE_IDENTIFIER = typeForClass(InstanceIdentifier.class);
+ public static final ConcreteType NOTIFICATION = typeForClass(Notification.class);
+ public static final ConcreteType NOTIFICATION_LISTENER = typeForClass(NotificationListener.class);
+ public static final ConcreteType RPC_SERVICE = typeForClass(RpcService.class);
+
+ private BindingTypes() {
+
+ }
+
+ public static final ParameterizedType augmentable(Type t) {
+ return parameterizedTypeFor(AUGMENTABLE, t);
+ }
+}
*/
package org.opendaylight.yangtools.binding.generator.util;
+import java.math.BigDecimal;
+import java.math.BigInteger;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.Future;
import org.opendaylight.yangtools.binding.generator.util.generated.type.builder.GeneratedTOBuilderImpl;
import org.opendaylight.yangtools.sal.binding.model.api.ConcreteType;
private static final Type SET_TYPE = typeForClass(Set.class);
private static final Type LIST_TYPE = typeForClass(List.class);
private static final Type MAP_TYPE = typeForClass(Map.class);
- public static final Type DATA_OBJECT = typeForClass(DataObject.class);
+ public static final ConcreteType NUMBER = typeForClass(Number.class);
+ public static final ConcreteType BIG_DECIMAL = typeForClass(BigDecimal.class);
+ public static final ConcreteType BIG_INTEGER = typeForClass(BigInteger.class);
+ public static final ConcreteType BYTE = typeForClass(Byte.class);
+ public static final ConcreteType BOOLEAN = typeForClass(Boolean.class);
+ public static final ConcreteType DOUBLE = typeForClass(Double.class);
+ public static final ConcreteType FLOAT = typeForClass(Float.class);
+ public static final ConcreteType INTEGER = typeForClass(Integer.class);
+ public static final ConcreteType LONG = typeForClass(Long.class);
+ public static final ConcreteType SHORT = typeForClass(Short.class);
+ public static final ConcreteType STRING = typeForClass(String.class);
+ public static final ConcreteType CHAR_SEQUENCE = typeForClass(CharSequence.class);
+ public static final ConcreteType THREAD = typeForClass(Thread.class);
+ public static final ConcreteType FUTURE = typeForClass(Future.class);
+ public static final ConcreteType CALLABLE = typeForClass(Callable.class);
+ public static final ConcreteType VOID = typeForClass(Void.class);
+ public static final ConcreteType THROWABLE = typeForClass(Throwable.class);
+ public static final ConcreteType EXCEPTION = typeForClass(Exception.class);
/**
* Creates the instance of type
* <code>void</code>
*/
public static ConcreteType voidType() {
- return new ConcreteTypeImpl(Void.class.getPackage().getName(), Void.class.getSimpleName());
+ return VOID;
}
/**
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
+import org.opendaylight.yangtools.binding.generator.util.BindingTypes;
import org.opendaylight.yangtools.binding.generator.util.Types;
import org.opendaylight.yangtools.binding.generator.util.generated.type.builder.GeneratedTypeBuilderImpl;
import org.opendaylight.yangtools.sal.binding.generator.api.BindingGenerator;
private GeneratedType createGeneratedType(String pkgName, String name) {
GeneratedTypeBuilder builder = new GeneratedTypeBuilderImpl(pkgName,
name);
- builder.addImplementsType(Types.DATA_OBJECT);
+ builder.addImplementsType(BindingTypes.DATA_OBJECT);
return builder.toInstance();
}