src/model.js
function Model(json, metadata, parent) {
        var jsonModel = json || {},
            modelMetadata = metadata || {},
            modelName = modelMetadata.name !== undefined? modelMetadata.name : "root",
            modelParent = parent || null;

        if (modelMetadata.name) { // name is not part of the metadata.
            delete modelMetadata.name;
        }

        //A Model is in itself a Property so lets call our supers constructor
        Property.call(this, modelName, jsonModel, modelParent, modelMetadata);

        if (this.validateValue(jsonModel)) {

            for (var name in jsonModel) {
                if (name.match(Model.PROPERTY_METADATA_SERIALIZED_NAME_REGEX)) { // skip special meta data properties
                    continue;
                }

                var value = jsonModel[name];
                var propertyMetadata = jsonModel[name + Model.PROPERTY_METADATA_SERIALIZED_NAME_SUFFIX];

                if (!modelMetadata.thin) {
                    this.createProperty(name, value, propertyMetadata);
                }
            }
        }
    }
function Model(json, metadata, parent) {
        var jsonModel = json || {},
            modelMetadata = metadata || {},
            modelName = modelMetadata.name !== undefined? modelMetadata.name : "root",
            modelParent = parent || null;

        if (modelMetadata.name) { // name is not part of the metadata.
            delete modelMetadata.name;
        }

        //A Model is in itself a Property so lets call our supers constructor
        Property.call(this, modelName, jsonModel, modelParent, modelMetadata);

        if (this.validateValue(jsonModel)) {

            for (var name in jsonModel) {
                if (name.match(Model.PROPERTY_METADATA_SERIALIZED_NAME_REGEX)) { // skip special meta data properties
                    continue;
                }

                var value = jsonModel[name];
                var propertyMetadata = jsonModel[name + Model.PROPERTY_METADATA_SERIALIZED_NAME_SUFFIX];

                if (!modelMetadata.thin) {
                    this.createProperty(name, value, propertyMetadata);
                }
            }
        }
    }
function Model ( json , metadata , parent ) { var jsonModel = json || { } , modelMetadata = metadata || { } , modelName = modelMetadata . name !== undefined ? modelMetadata . name : "root" , modelParent = parent || null ; if ( modelMetadata . name ) { // name is not part of the metadata.
 delete modelMetadata . name ; } //A Model is in itself a Property so lets call our supers constructor
 Property . call ( this , modelName , jsonModel , modelParent , modelMetadata ) ; if ( this . validateValue ( jsonModel ) ) { for ( var name in jsonModel ) { if ( name . match ( Model . PROPERTY_METADATA_SERIALIZED_NAME_REGEX ) ) { // skip special meta data properties
 continue ; } var value = jsonModel [ name ] ; var propertyMetadata = jsonModel [ name + Model . PROPERTY_METADATA_SERIALIZED_NAME_SUFFIX ] ; if ( ! modelMetadata . thin ) { this . createProperty ( name , value , propertyMetadata ) ; } } } }
The model Object that wraps the JSON.

@example
For examples see: <b>testPrimitiveSaveLoad</b>,  <b>testObjectsSaveLoad</b>, <b>testComplexSaveLoad</b>
<b>testGetNameMethod</b> and <b>testSaveLoadWithMetaData</b>

@class Model
@constructor
@extends Property

@param {Object} json?    The json object to be modeled.
@param {Object} metadata? May contain the following:
name - name of the Model, defaults to "root"
*plus any properties accepted by the createProperty method metadata argument or
additional data you want stored in the metadata.
The model Object that wraps the JSON .