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