89d7a8cc76bb7919d772b2f9895384b94221ee67
[mdsal.git] / code-generator / binding-generator-spi / src / main / java / org / opendaylight / yangtools / sal / binding / generator / spi / TypeProvider.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.yangtools.sal.binding.generator.spi;
9
10 import org.opendaylight.yangtools.sal.binding.model.api.Restrictions;
11 import org.opendaylight.yangtools.sal.binding.model.api.Type;
12 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
13 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
14 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
15
16 public interface TypeProvider {
17
18     @Deprecated
19     Type javaTypeForYangType(String type);
20
21     /**
22      * Resolve of yang Type Definition to it's java counter part.
23      * If the Type Definition contains one of yang primitive types the method
24      * will return java.lang. counterpart. (For example if yang type is int32
25      * the java counterpart is java.lang.Integer). In case that Type
26      * Definition contains extended type defined via yang typedef statement
27      * the method SHOULD return Generated Type or Generated Transfer Object
28      * if that Type is correctly referenced to resolved imported yang module.
29      * The method will return <code>null</code> value in situations that
30      * TypeDefinition can't be resolved (either due missing yang import or
31      * incorrectly specified type).
32      *
33      *
34      * @param type Type Definition to resolve from
35      * @return Resolved Type
36      */
37     Type javaTypeForSchemaDefinitionType(final TypeDefinition<?> type, final SchemaNode parentNode);
38
39     Type javaTypeForSchemaDefinitionType(final TypeDefinition<?> type, final SchemaNode parentNode, final Restrictions restrictions);
40
41     /**
42      * Returns string containing code for creation of new type instance.
43      *
44      * @param node
45      * @return
46      */
47     String getTypeDefaultConstruction(LeafSchemaNode node);
48
49     String getConstructorPropertyName(SchemaNode node);
50
51     String getParamNameFromType(TypeDefinition<?> type);
52
53 }