Remove TypeProvider interface
[mdsal.git] / binding / mdsal-binding-generator / src / main / java / org / opendaylight / mdsal / binding / yang / types / AbstractTypeProvider.java
index 7678e3a2941f3900fe4f0790b303804d6ed858ac..d1ce0888c97e0f9a639a81d58210ae39e0f7eda1 100644 (file)
@@ -70,7 +70,7 @@ import org.opendaylight.yangtools.yang.model.spi.ModuleDependencySort;
 
 // FIXME: remove this class
 @Deprecated(forRemoval = true)
-abstract class AbstractTypeProvider implements TypeProvider {
+abstract class AbstractTypeProvider {
     private static final JavaTypeName DEPRECATED_ANNOTATION = JavaTypeName.create(Deprecated.class);
     private static final CharMatcher DASH_COLON_MATCHER = CharMatcher.anyOf("-:");
 
@@ -124,7 +124,41 @@ abstract class AbstractTypeProvider implements TypeProvider {
         return additionalTypes;
     }
 
-    @Override
+    /**
+     * Resolve of YANG Type Definition to it's java counter part. If the Type Definition contains one of YANG primitive
+     * types the method will return {@code java.lang.} counterpart. (For example if YANG type is int32 the Java
+     * counterpart is {@link Integer}). In case that Type Definition contains extended type defined via YANG typedef
+     * statement the method SHOULD return Generated Type or Generated Transfer Object if that Type is correctly
+     * referenced to resolved imported YANG module.
+     *
+     * <p>
+     * The method will return <code>null</code> value in situations that TypeDefinition can't be resolved (either due
+     * to missing YANG import or incorrectly specified type).
+     *
+     * <p>
+     * {@code leafref} resolution for relative paths has two models of operation: lenient and strict. This is needed to
+     * handle the case where a grouping leaf's path points outside of the grouping tree. In such a case we cannot
+     * completely determine the correct type and need to fallback to {@link Object}.
+     *
+     * @param type Type Definition to resolve from
+     * @param lenientRelativeLeafrefs treat relative leafrefs leniently
+     * @return Resolved Type
+     */
+    public Type javaTypeForSchemaDefinitionType(final TypeDefinition<?> type, final SchemaNode parentNode) {
+        return javaTypeForSchemaDefinitionType(type, parentNode, null);
+    }
+
+    /**
+     * Converts schema definition type <code>typeDefinition</code> to JAVA <code>Type</code>.
+     *
+     * @param typeDefinition type definition which is converted to JAVA type
+     * @throws IllegalArgumentException
+     *             <ul>
+     *             <li>if <code>typeDefinition</code> equal null</li>
+     *             <li>if Qname of <code>typeDefinition</code> equal null</li>
+     *             <li>if name of <code>typeDefinition</code> equal null</li>
+     *             </ul>
+     */
     public Type javaTypeForSchemaDefinitionType(final TypeDefinition<?> typeDefinition, final SchemaNode parentNode,
             final Restrictions restrictions) {
         throw new UnsupportedOperationException();