import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Map;
+import org.opendaylight.mdsal.binding.javav2.generator.context.ModuleContext;
import org.opendaylight.mdsal.binding.javav2.generator.spi.TypeProvider;
import org.opendaylight.mdsal.binding.javav2.generator.util.JavaIdentifier;
-import org.opendaylight.mdsal.binding.javav2.generator.util.NonJavaCharsConverter;
+import org.opendaylight.mdsal.binding.javav2.generator.util.JavaIdentifierNormalizer;
import org.opendaylight.mdsal.binding.javav2.generator.util.Types;
import org.opendaylight.mdsal.binding.javav2.model.api.Restrictions;
import org.opendaylight.mdsal.binding.javav2.model.api.Type;
* returned.
*/
@Override
- public Type javaTypeForSchemaDefinitionType(final TypeDefinition<?> type, final SchemaNode parentNode) {
+ public Type javaTypeForSchemaDefinitionType(final TypeDefinition<?> type, final SchemaNode parentNode,
+ ModuleContext context) {
if (type != null) {
return TYPE_MAP.get(type.getQName().getLocalName());
}
@Override
public Type javaTypeForSchemaDefinitionType(final TypeDefinition<?> type, final SchemaNode parentNode,
- final Restrictions restrictions) {
+ final Restrictions restrictions, ModuleContext context) {
- String typeName = type.getQName().getLocalName();
+ final String typeName = type.getQName().getLocalName();
switch (typeName) {
case "binary":
return restrictions == null ? Types.BYTE_ARRAY : Types.primitiveType("byte[]", restrictions);
case "decimal64":
- return Types.typeForClass(BigDecimal.class, restrictions);
+ return Types.typeForClass(BigDecimal.class, restrictions, context);
case "enumeration":
- return Types.typeForClass(Enum.class, restrictions);
+ return Types.typeForClass(Enum.class, restrictions, context);
case "int8":
- return Types.typeForClass(Byte.class, restrictions);
+ return Types.typeForClass(Byte.class, restrictions, context);
case "int16":
- return Types.typeForClass(Short.class, restrictions);
+ return Types.typeForClass(Short.class, restrictions, context);
case "int32":
- return Types.typeForClass(Integer.class, restrictions);
+ return Types.typeForClass(Integer.class, restrictions, context);
case "int64":
- return Types.typeForClass(Long.class, restrictions);
+ return Types.typeForClass(Long.class, restrictions, context);
case "string":
- return Types.typeForClass(String.class, restrictions);
+ return Types.typeForClass(String.class, restrictions, context);
case "uint8":
- return Types.typeForClass(Short.class, restrictions);
+ return Types.typeForClass(Short.class, restrictions, context);
case "uint16":
- return Types.typeForClass(Integer.class, restrictions);
+ return Types.typeForClass(Integer.class, restrictions, context);
case "uint32":
- return Types.typeForClass(Long.class, restrictions);
+ return Types.typeForClass(Long.class, restrictions, context);
case "uint64":
- return Types.typeForClass(BigInteger.class, restrictions);
+ return Types.typeForClass(BigInteger.class, restrictions, context);
case "union" :
return UNION_TYPE;
default:
- return javaTypeForSchemaDefinitionType(type, parentNode);
+ return javaTypeForSchemaDefinitionType(type, parentNode, context);
}
}
@Override
public String getParamNameFromType(final TypeDefinition<?> type) {
- return NonJavaCharsConverter.convertIdentifier(BindingMapping.getPropertyName(type.getQName()
- .getLocalName()), JavaIdentifier.METHOD);
+ return JavaIdentifierNormalizer.normalizeSpecificIdentifier(type.getQName().getLocalName(),
+ JavaIdentifier.METHOD);
}
};