2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.yangtools.sal.binding.generator.spi;
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;
16 public interface TypeProvider {
19 Type javaTypeForYangType(String type);
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).
34 * @param type Type Definition to resolve from
35 * @return Resolved Type
37 Type javaTypeForSchemaDefinitionType(final TypeDefinition<?> type, final SchemaNode parentNode);
39 Type javaTypeForSchemaDefinitionType(final TypeDefinition<?> type, final SchemaNode parentNode, final Restrictions restrictions);
42 * Returns string containing code for creation of new type instance.
47 String getTypeDefaultConstruction(LeafSchemaNode node);
49 String getConstructorPropertyName(SchemaNode node);
51 String getParamNameFromType(TypeDefinition<?> type);