-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.sal.binding.yang.types;\r
-\r
-import java.math.BigDecimal;\r
-import java.math.BigInteger;\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-import org.opendaylight.controller.binding.generator.util.Types;\r
-import org.opendaylight.controller.sal.binding.generator.spi.TypeProvider;\r
-import org.opendaylight.controller.sal.binding.model.api.Type;\r
-import org.opendaylight.controller.yang.model.api.TypeDefinition;\r
-\r
-public class BaseYangTypes {\r
-\r
- private static Map<String, Type> typeMap = new HashMap<String, Type>();\r
-\r
- public static final Type BOOLEAN_TYPE = Types.typeForClass(Boolean.class);\r
- public static final Type INT8_TYPE = Types.typeForClass(Byte.class);\r
- public static final Type INT16_TYPE = Types.typeForClass(Short.class);\r
- public static final Type INT32_TYPE = Types.typeForClass(Integer.class);\r
- public static final Type INT64_TYPE = Types.typeForClass(Long.class);\r
- public static final Type STRING_TYPE = Types.typeForClass(String.class);\r
- public static final Type DECIMAL64_TYPE = Types.typeForClass(Double.class);\r
- public static final Type UINT8_TYPE = Types.typeForClass(Short.class);\r
- public static final Type UINT16_TYPE = Types.typeForClass(Integer.class);\r
- public static final Type UINT32_TYPE = Types.typeForClass(Long.class);\r
- public static final Type UINT64_TYPE = Types.typeForClass(BigInteger.class);\r
-\r
- static {\r
- typeMap.put("boolean", BOOLEAN_TYPE);\r
- typeMap.put("int8", INT8_TYPE);\r
- typeMap.put("int16", INT16_TYPE);\r
- typeMap.put("int32", INT32_TYPE);\r
- typeMap.put("int64", INT64_TYPE);\r
- typeMap.put("string", STRING_TYPE);\r
- typeMap.put("decimal64", DECIMAL64_TYPE);\r
- typeMap.put("uint8", UINT8_TYPE);\r
- typeMap.put("uint16", UINT16_TYPE);\r
- typeMap.put("uint32", UINT32_TYPE);\r
- typeMap.put("uint64", UINT64_TYPE);\r
- }\r
-\r
- public static final TypeProvider BASE_YANG_TYPES_PROVIDER = new TypeProvider() {\r
-\r
- @Override\r
- public Type javaTypeForYangType(String type) {\r
- return typeMap.get(type);\r
- }\r
-\r
- @Override\r
- public Type javaTypeForSchemaDefinitionType(TypeDefinition<?> type) {\r
- if (type != null) {\r
- return typeMap.get(type.getQName().getLocalName());\r
- }\r
-\r
- return null;\r
- }\r
- };\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. 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.controller.sal.binding.yang.types;
+
+import java.math.BigInteger;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.opendaylight.controller.binding.generator.util.Types;
+import org.opendaylight.controller.sal.binding.generator.spi.TypeProvider;
+import org.opendaylight.controller.sal.binding.model.api.Type;
+import org.opendaylight.controller.yang.model.api.TypeDefinition;
+
+public class BaseYangTypes {
+
+ private static Map<String, Type> typeMap = new HashMap<String, Type>();
+
+ public static final Type BOOLEAN_TYPE = Types.typeForClass(Boolean.class);
+ public static final Type INT8_TYPE = Types.typeForClass(Byte.class);
+ public static final Type INT16_TYPE = Types.typeForClass(Short.class);
+ public static final Type INT32_TYPE = Types.typeForClass(Integer.class);
+ public static final Type INT64_TYPE = Types.typeForClass(Long.class);
+ public static final Type STRING_TYPE = Types.typeForClass(String.class);
+ public static final Type DECIMAL64_TYPE = Types.typeForClass(Double.class);
+ public static final Type UINT8_TYPE = Types.typeForClass(Short.class);
+ public static final Type UINT16_TYPE = Types.typeForClass(Integer.class);
+ public static final Type UINT32_TYPE = Types.typeForClass(Long.class);
+ public static final Type UINT64_TYPE = Types.typeForClass(BigInteger.class);
+
+ static {
+ typeMap.put("boolean", BOOLEAN_TYPE);
+ typeMap.put("int8", INT8_TYPE);
+ typeMap.put("int16", INT16_TYPE);
+ typeMap.put("int32", INT32_TYPE);
+ typeMap.put("int64", INT64_TYPE);
+ typeMap.put("string", STRING_TYPE);
+ typeMap.put("decimal64", DECIMAL64_TYPE);
+ typeMap.put("uint8", UINT8_TYPE);
+ typeMap.put("uint16", UINT16_TYPE);
+ typeMap.put("uint32", UINT32_TYPE);
+ typeMap.put("uint64", UINT64_TYPE);
+ }
+
+ public static final TypeProvider BASE_YANG_TYPES_PROVIDER = new TypeProvider() {
+
+ @Override
+ public Type javaTypeForYangType(String type) {
+ return typeMap.get(type);
+ }
+
+ @Override
+ public Type javaTypeForSchemaDefinitionType(TypeDefinition<?> type) {
+ if (type != null) {
+ return typeMap.get(type.getQName().getLocalName());
+ }
+
+ return null;
+ }
+ };
+
+}