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.mdsal.binding.generator.spi;
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;
16 public interface TypeProvider {
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).
30 * @param type Type Definition to resolve from
31 * @return Resolved Type
33 Type javaTypeForSchemaDefinitionType(TypeDefinition<?> type, SchemaNode parentNode);
35 Type javaTypeForSchemaDefinitionType(TypeDefinition<?> type, SchemaNode parentNode, Restrictions restrictions);
38 * Returns string containing code for creation of new type instance.
40 String getTypeDefaultConstruction(LeafSchemaNode node);
42 String getConstructorPropertyName(SchemaNode node);
44 String getParamNameFromType(TypeDefinition<?> type);