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.generator.context.ModuleContext;
13 import org.opendaylight.mdsal.binding.javav2.model.api.Restrictions;
14 import org.opendaylight.mdsal.binding.javav2.model.api.Type;
15 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
16 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
17 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
20 * Service provider interface that defines contract for generated types.
23 public interface TypeProvider {
26 * Resolve of yang Type Definition to its java counter part.
27 * If the Type Definition contains one of yang primitive types the method
28 * will return java.lang. counterpart. (For example if yang type is int32
29 * the java counterpart is java.lang.Integer). In case that Type
30 * Definition contains extended type defined via yang typedef statement
31 * the method SHOULD return Generated Type or Generated Transfer Object
32 * if that Type is correctly referenced to resolved imported yang module.
33 * The method will return <code>null</code> value in situations that
34 * TypeDefinition can't be resolved (either due missing yang import or
35 * incorrectly specified type).
38 * @param type Type Definition to resolve from
39 * @param parentNode parent node
40 * @return Resolved Type
42 Type javaTypeForSchemaDefinitionType(TypeDefinition<?> type, SchemaNode parentNode, ModuleContext context);
46 * @param type Type Definition to resolve from
47 * @param parentNode parent node
48 * @param restrictions restrictions applied to given type definition
49 * @return Resolved Type
51 Type javaTypeForSchemaDefinitionType(TypeDefinition<?> type, SchemaNode parentNode, Restrictions restrictions,
52 ModuleContext context);
55 * Returns string containing code for creation of new type instance.
57 * @param node Schema node to resolve from
58 * @return String representing default construction
60 String getTypeDefaultConstruction(LeafSchemaNode node);
64 * @param node Schema node to resolve from
65 * @return String representing constructor property name
67 String getConstructorPropertyName(SchemaNode node);
71 * @param type Type Definition to resolve from
72 * @return String representing parameter name
74 String getParamNameFromType(TypeDefinition<?> type);