command.js
// Generate the names for the model, the types, and the interfaces
Generate the names for the model, the types, and the interfaces
Generate the names for the model the types and the interfaces
function generateNames(model, prefix, name) {
    if (typeof name === "undefined") { name = ""; }
    model.fullPackageName = prefix + (name != "." ? name : "");
    model.properties = argv.properties;
    model.camelCaseGetSet = argv.camelCaseGetSet;
    model.underscoreGetSet = argv.underscoreGetSet;
    var newDefinitions = {};
    var key;
    for (key in model.messages) {
        var message = model.messages[key];
        newDefinitions[message.name] = "Builder";
        generateNames(message, model.fullPackageName, "." + (model.name ? model.name : ""));
    }
    for (key in model.enums) {
        var currentEnum = model.enums[key];
        newDefinitions[currentEnum.name] = "";
        currentEnum.fullPackageName = model.fullPackageName + (model.name ? "." + model.name : "");
    }
    for (key in model.fields) {
        var field = model.fields[key];
        if (typeof newDefinitions[field.type] !== "undefined") {
            field.type = model.name + "." + field.type;
        }
    }
    var definitions = [];
    for (key in newDefinitions) {
        definitions.push({ name: key, type: ((model.name ? (model.name + ".") : "") + key) + newDefinitions[key] });
    }
    model.definitions = definitions;
}
function generateNames ( model , prefix , name ) { if ( typeof name === "undefined" ) { name = "" ; } model . fullPackageName = prefix + ( name != "." ? name : "" ) ; model . properties = argv . properties ; model . camelCaseGetSet = argv . camelCaseGetSet ; model . underscoreGetSet = argv . underscoreGetSet ; var newDefinitions = { } ; var key ; for ( key in model . messages ) { var message = model . messages [ key ] ; newDefinitions [ message . name ] = "Builder" ; generateNames ( message , model . fullPackageName , "." + ( model . name ? model . name : "" ) ) ; } for ( key in model . enums ) { var currentEnum = model . enums [ key ] ; newDefinitions [ currentEnum . name ] = "" ; currentEnum . fullPackageName = model . fullPackageName + ( model . name ? "." + model . name : "" ) ; } for ( key in model . fields ) { var field = model . fields [ key ] ; if ( typeof newDefinitions [ field . type ] !== "undefined" ) { field . type = model . name + "." + field . type ; } } var definitions = [ ] ; for ( key in newDefinitions ) { definitions . push ( { name : key , type : ( ( model . name ? ( model . name + "." ) : "" ) + key ) + newDefinitions [ key ] } ) ; } model . definitions = definitions ; }
Generate the names for the model, the types, and the interfaces
Generate the names for the model the types and the interfaces
// Copies the settings (I'm lazy) // Generate names for messages // Recursive call for all messages // Add the new definitions in the model for generate builders