bf3a188f36ec93daa3cdd892c5d43ff66dd87ee4
[yangtools.git] / code-generator / binding-generator-spi / src / main / java / org / opendaylight / yangtools / sal / binding / generator / spi / TypeProvider.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.yangtools.sal.binding.generator.spi;\r
9 \r
10 import org.opendaylight.yangtools.sal.binding.model.api.Restrictions;\r
11 import org.opendaylight.yangtools.sal.binding.model.api.Type;\r
12 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;\r
13 import org.opendaylight.yangtools.yang.model.api.SchemaNode;\r
14 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;\r
15 \r
16 public interface TypeProvider {\r
17 \r
18     @Deprecated\r
19     Type javaTypeForYangType(String type);\r
20 \r
21     /**\r
22      * Resolve of yang Type Definition to it's java counter part.\r
23      * If the Type Definition contains one of yang primitive types the method\r
24      * will return java.lang. counterpart. (For example if yang type is int32\r
25      * the java counterpart is java.lang.Integer). In case that Type\r
26      * Definition contains extended type defined via yang typedef statement\r
27      * the method SHOULD return Generated Type or Generated Transfer Object\r
28      * if that Type is correctly referenced to resolved imported yang module.\r
29      * The method will return <code>null</code> value in situations that\r
30      * TypeDefinition can't be resolved (either due missing yang import or\r
31      * incorrectly specified type).\r
32      *\r
33      *\r
34      * @param type Type Definition to resolve from\r
35      * @return Resolved Type\r
36      */\r
37     Type javaTypeForSchemaDefinitionType(final TypeDefinition<?> type, final SchemaNode parentNode);\r
38 \r
39     Type javaTypeForSchemaDefinitionType(final TypeDefinition<?> type, final SchemaNode parentNode, final Restrictions restrictions);\r
40 \r
41     /**\r
42      * Returns string containing code for creation of new type instance.\r
43      *\r
44      * @param node\r
45      * @return\r
46      */\r
47     String getTypeDefaultConstruction(LeafSchemaNode node);\r
48 \r
49     String getConstructorPropertyName(SchemaNode node);\r
50 }\r