Initial opendaylight infrastructure commit!!
[controller.git] / opendaylight / sal / yang-prototype / code-generator / binding-generator-impl / src / main / java / org / opendaylight / controller / sal / binding / yang / types / TypeProviderImpl.java
1 /*\r
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
3  *\r
4  * This program and the accompanying materials are made available under the\r
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
6  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
7  */\r
8 package org.opendaylight.controller.sal.binding.yang.types;\r
9 \r
10 import org.opendaylight.controller.sal.binding.generator.spi.TypeProvider;\r
11 import org.opendaylight.controller.sal.binding.model.api.Type;\r
12 import org.opendaylight.controller.yang.model.api.TypeDefinition;\r
13 \r
14 public class TypeProviderImpl implements TypeProvider {\r
15 \r
16     /*\r
17      * (non-Javadoc)\r
18      * \r
19      * @see org.opendaylight.controller.yang.model.type.provider.TypeProvider#\r
20      * javaTypeForYangType(java.lang.String)\r
21      */\r
22     @Override\r
23     public Type javaTypeForYangType(String type) {\r
24         Type t = BaseYangTypes.BASE_YANG_TYPES_PROVIDER\r
25                 .javaTypeForYangType(type);\r
26         // TODO: this needs to be implemented in better way\r
27         // if(t == null) {\r
28         // t = BaseYangTypes.IETF_INET_TYPES_PROVIDER.javaTypeForYangType(type);\r
29         // }\r
30         return t;\r
31     }\r
32 \r
33     @Override\r
34     public Type javaTypeForSchemaDefinitionType(final TypeDefinition<?> type) {\r
35         if (type != null) {\r
36             Type t = BaseYangTypes.BASE_YANG_TYPES_PROVIDER\r
37                     .javaTypeForSchemaDefinitionType(type);\r
38 \r
39             if (t != null) {\r
40                 return t;\r
41             }\r
42         }\r
43         return null;\r
44     }\r
45 }\r