json: Add missing documentation.
authorJean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Fri, 28 Nov 2014 17:17:38 +0000 (12:17 -0500)
committerJean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Fri, 28 Nov 2014 17:38:30 +0000 (12:38 -0500)
Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

lib/json/dynamic.nit
lib/json/static.nit

index d15ceb7..578afb1 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# Dynamic interface to read Json strings.
+# Dynamic interface to read JSON strings.
 #
 # `String::to_json_value` returns a `JsonValue` which can be queried
-# to get the underlying Json data. It can also be used as any Json types.
+# to get the underlying JSON data.
 module dynamic
 
 import error
 private import static
 
+# Wraps a JSON value.
+#
+# Offer methods to query the type, to dynamicaly cast the underlying value and
+# to query elements (in case of a JSON object or a JSON array).
+#
+# Use `String::to_json_value` to get a `JsonValue` from a string.
 class JsonValue
+
+       # The wrapped JSON value.
        var value: nullable Object
 
        # Is this value null?
index 3ed9929..bb578fd 100644 (file)
@@ -319,6 +319,7 @@ end
 # Redef parser
 
 redef class Nvalue
+       # The represented value.
        private fun to_nit_object: nullable Jsonable is abstract
 end
 
@@ -348,6 +349,7 @@ redef class Nvalue_null
 end
 
 redef class Nstring
+       # The represented string.
        private fun to_nit_string: String do
                var res = new FlatBuffer
                var i = 1
@@ -398,6 +400,7 @@ redef class Nvalue_object
 end
 
 redef class Nmembers
+       # All the key-value pairs.
        private fun pairs: Array[Npair] is abstract
 end
 
@@ -415,7 +418,10 @@ redef class Nmembers_head
 end
 
 redef class Npair
+       # The represented key.
        private fun name: String do return n_string.to_nit_string
+
+       # The represented value.
        private fun value: nullable Jsonable do return n_value.to_nit_object
 end
 
@@ -433,6 +439,7 @@ redef class Nvalue_array
 end
 
 redef class Nelements
+       # All the items.
        private fun items: Array[Nvalue] is abstract
 end