Update TypeDefinition design
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / TypeDefinition.java
index 53ec6ac3e11f3cb598b300275e28423bad8f52ff..341f78a120466bdca1f4e35d526345abf0b5bfe0 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.model.api;
 
+import java.util.Optional;
+
 /**
  * YANG statement <code>typedef</code> contains also substatements
  * <ul>
@@ -17,8 +19,9 @@ package org.opendaylight.yangtools.yang.model.api;
  * <li><code>units</code> - textual information about units associated with this
  * type.</li>
  * </ul>
- * This interface contains the methods for getting the values of the arguments
- * of substatements mentioned above.
+ * This interface contains the methods for getting the values of the arguments of substatements mentioned above.
+ * Furthermore {@link LeafSchemaNode} and {@link LeafListSchemaNode} interfaces contribute to their internal type
+ * definitions.
  *
  * @param <T>
  *            type of the base type (YANG <code>type</code> substatement) which
@@ -26,8 +29,7 @@ package org.opendaylight.yangtools.yang.model.api;
  */
 public interface TypeDefinition<T extends TypeDefinition<?>> extends SchemaNode {
     /**
-     * Returns the base type from which this type is derived. If this is yang
-     * built-in type, returns null.
+     * Returns the base type from which this type is derived. If this is yang built-in type, returns null.
      *
      * @return value of <code>&lt;T&gt;</code> type which represents the base
      *         type of instance of the <code>TypeDefinition</code> type or null,
@@ -36,21 +38,18 @@ public interface TypeDefinition<T extends TypeDefinition<?>> extends SchemaNode
     T getBaseType();
 
     /**
-     * Returns the unit which represents the value of the argument of the
-     * <code>units</code> substatement of the YANG <code>typedef</code>
-     * statement.
+     * Returns the unit which represents the value of the argument of the <code>units</code> substatement of the YANG
+     * <code>typedef</code>, <code>leaf</code> or <code>leaf-list</code> statements.
      *
      * @return string with units in which is type measured
      */
-    String getUnits();
+    Optional<String> getUnits();
 
     /**
-     * Returns the default value which represents the value of the argument of
-     * the <code>default</code> substatement of the YANG <code>typedef</code>
-     * statement.
+     * Returns the default value which represents the value of the argument of the <code>default</code> substatement
+     * of the YANG <code>typedef</code> or <code>leaf</code> statement.
      *
-     * @return instance of <code>Object</code> type which contains default value
-     *         for <code>typedef</code>
+     * @return instance of <code>Object</code> type which contains default value for <code>typedef</code>
      */
-    Object getDefaultValue();
+    Optional<? extends Object> getDefaultValue();
 }