2 * Copyright (c) 2017 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
9 package org.opendaylight.mdsal.binding.javav2.generator.spi;
11 import com.google.common.annotations.Beta;
12 import org.opendaylight.mdsal.binding.javav2.model.api.Restrictions;
13 import org.opendaylight.mdsal.binding.javav2.model.api.Type;
14 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
15 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
16 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
19 * Service provider interface that defines contract for generated types.
22 public interface TypeProvider {
25 * Resolve of yang Type Definition to its java counter part.
26 * If the Type Definition contains one of yang primitive types the method
27 * will return java.lang. counterpart. (For example if yang type is int32
28 * the java counterpart is java.lang.Integer). In case that Type
29 * Definition contains extended type defined via yang typedef statement
30 * the method SHOULD return Generated Type or Generated Transfer Object
31 * if that Type is correctly referenced to resolved imported yang module.
32 * The method will return <code>null</code> value in situations that
33 * TypeDefinition can't be resolved (either due missing yang import or
34 * incorrectly specified type).
37 * @param type Type Definition to resolve from
38 * @param parentNode parent node
39 * @return Resolved Type
41 Type javaTypeForSchemaDefinitionType(TypeDefinition<?> type, SchemaNode parentNode);
45 * @param type Type Definition to resolve from
46 * @param parentNode parent node
47 * @param restrictions restrictions applied to given type definition
48 * @return Resolved Type
50 Type javaTypeForSchemaDefinitionType(TypeDefinition<?> type, SchemaNode parentNode, Restrictions restrictions);
53 * Returns string containing code for creation of new type instance.
55 * @param node Schema node to resolve from
56 * @return String representing default construction
58 String getTypeDefaultConstruction(LeafSchemaNode node);
62 * @param node Schema node to resolve from
63 * @return String representing constructor property name
65 String getConstructorPropertyName(SchemaNode node);
69 * @param type Type Definition to resolve from
70 * @return String representing parameter name
72 String getParamNameFromType(TypeDefinition<?> type);