How to use the @accordproject/concerto-tools.CodeGen function in @accordproject/concerto-tools

To help you get started, we’ve selected a few @accordproject/concerto-tools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github accordproject / cicero / packages / cicero-tools / lib / codegen / fromcto / corda / cordaplugin.js View on Github external
* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

'use strict';

const AbstractPlugin = require('@accordproject/concerto-tools').CodeGen.AbstractPlugin;

/**
 * Simple Corda plug-in class for code-generation.
 */
class CordaPlugin extends AbstractPlugin {
    /**
     * Additional imports to generate in classes
     * @param {ClassDeclaration} clazz - the clazz being visited
     * @param {Object} parameters  - the parameter
     * @param {Object} options  - the visitor options
     */
    addClassImports(clazz, parameters, options) {
        // add Corda-specific imports
        parameters.fileWriter.writeLine(0, 'import net.corda.core.serialization.CordaSerializable;');
        if(clazz.getFullyQualifiedName() === 'org.accordproject.money.MonetaryAmount') {
            parameters.fileWriter.writeLine(0, 'import java.math.BigDecimal;');
github accordproject / cicero / packages / cicero-tools / lib / codegen / codegen.js View on Github external
* Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

'use strict';

module.exports.AbstractPlugin = require('@accordproject/concerto-tools').CodeGen.AbstractPlugin;

module.exports.GoLangVisitor = require('@accordproject/concerto-tools').CodeGen.GoLangVisitor;
module.exports.JSONSchemaVisitor = require('@accordproject/concerto-tools').CodeGen.JSONSchemaVisitor;
module.exports.XmlSchemaVisitor = require('@accordproject/concerto-tools').CodeGen.XmlSchemaVisitor;
module.exports.PlantUMLVisitor = require('@accordproject/concerto-tools').CodeGen.PlantUMLVisitor;
module.exports.TypescriptVisitor = require('@accordproject/concerto-tools').CodeGen.TypescriptVisitor;
module.exports.JavaVisitor = require('@accordproject/concerto-tools').CodeGen.JavaVisitor;
module.exports.FileWriter = require('@accordproject/concerto-tools').FileWriter;

module.exports.CordaVisitor = require('./fromcto/corda/cordavisitor');
github accordproject / cicero / packages / cicero-tools / lib / codegen / fromcto / corda / cordavisitor.js View on Github external
* you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

'use strict';

const CordaPlugin = require('./cordaplugin.js');
const JavaVisitor = require('@accordproject/concerto-tools').CodeGen.JavaVisitor;

/**
 * Convert the contents of a ModelManager to Java code for Corda.
 * Set a fileWriter property (instance of FileWriter) on the parameters
 * object to control where the generated code is written to disk.
 *
 * @private
 * @class
 * @memberof module:concerto-tools
 */
class CordaVisitor extends JavaVisitor {
    /**
     * Create the JavaVisitor.
     */
    constructor() {
        super();
github accordproject / cicero / packages / cicero-tools / lib / codegen / codegen.js View on Github external
* You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

'use strict';

module.exports.AbstractPlugin = require('@accordproject/concerto-tools').CodeGen.AbstractPlugin;

module.exports.GoLangVisitor = require('@accordproject/concerto-tools').CodeGen.GoLangVisitor;
module.exports.JSONSchemaVisitor = require('@accordproject/concerto-tools').CodeGen.JSONSchemaVisitor;
module.exports.XmlSchemaVisitor = require('@accordproject/concerto-tools').CodeGen.XmlSchemaVisitor;
module.exports.PlantUMLVisitor = require('@accordproject/concerto-tools').CodeGen.PlantUMLVisitor;
module.exports.TypescriptVisitor = require('@accordproject/concerto-tools').CodeGen.TypescriptVisitor;
module.exports.JavaVisitor = require('@accordproject/concerto-tools').CodeGen.JavaVisitor;
module.exports.FileWriter = require('@accordproject/concerto-tools').FileWriter;

module.exports.CordaVisitor = require('./fromcto/corda/cordavisitor');
github accordproject / concerto / packages / concerto-cli / lib / commands.js View on Github external
* See the License for the specific language governing permissions and
 * limitations under the License.
 */

'use strict';

const fs = require('fs');
const path = require('path');
const mkdirp = require('mkdirp');

const Logger = require('@accordproject/concerto-core').Logger;
const ModelLoader = require('@accordproject/concerto-core').ModelLoader;
const Factory = require('@accordproject/concerto-core').Factory;
const Serializer = require('@accordproject/concerto-core').Serializer;
const FileWriter = require('@accordproject/concerto-tools').FileWriter;
const CodeGen = require('@accordproject/concerto-tools').CodeGen;

const GoLangVisitor = CodeGen.GoLangVisitor;
const JavaVisitor = CodeGen.JavaVisitor;
const JSONSchemaVisitor = CodeGen.JSONSchemaVisitor;
const PlantUMLVisitor = CodeGen.PlantUMLVisitor;
const TypescriptVisitor = CodeGen.TypescriptVisitor;
const XmlSchemaVisitor = CodeGen.XmlSchemaVisitor;

/**
 * Utility class that implements the commands exposed by the CLI.
 * @class
 * @memberof module:concerto-cli
 */
class Commands {
    /**
     * Set a default for a file argument
github accordproject / cicero / packages / cicero-tools / lib / codegen / codegen.js View on Github external
* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

'use strict';

module.exports.AbstractPlugin = require('@accordproject/concerto-tools').CodeGen.AbstractPlugin;

module.exports.GoLangVisitor = require('@accordproject/concerto-tools').CodeGen.GoLangVisitor;
module.exports.JSONSchemaVisitor = require('@accordproject/concerto-tools').CodeGen.JSONSchemaVisitor;
module.exports.XmlSchemaVisitor = require('@accordproject/concerto-tools').CodeGen.XmlSchemaVisitor;
module.exports.PlantUMLVisitor = require('@accordproject/concerto-tools').CodeGen.PlantUMLVisitor;
module.exports.TypescriptVisitor = require('@accordproject/concerto-tools').CodeGen.TypescriptVisitor;
module.exports.JavaVisitor = require('@accordproject/concerto-tools').CodeGen.JavaVisitor;
module.exports.FileWriter = require('@accordproject/concerto-tools').FileWriter;

module.exports.CordaVisitor = require('./fromcto/corda/cordavisitor');
github accordproject / cicero / packages / cicero-tools / lib / codegen / codegen.js View on Github external
* http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

'use strict';

module.exports.AbstractPlugin = require('@accordproject/concerto-tools').CodeGen.AbstractPlugin;

module.exports.GoLangVisitor = require('@accordproject/concerto-tools').CodeGen.GoLangVisitor;
module.exports.JSONSchemaVisitor = require('@accordproject/concerto-tools').CodeGen.JSONSchemaVisitor;
module.exports.XmlSchemaVisitor = require('@accordproject/concerto-tools').CodeGen.XmlSchemaVisitor;
module.exports.PlantUMLVisitor = require('@accordproject/concerto-tools').CodeGen.PlantUMLVisitor;
module.exports.TypescriptVisitor = require('@accordproject/concerto-tools').CodeGen.TypescriptVisitor;
module.exports.JavaVisitor = require('@accordproject/concerto-tools').CodeGen.JavaVisitor;
module.exports.FileWriter = require('@accordproject/concerto-tools').FileWriter;

module.exports.CordaVisitor = require('./fromcto/corda/cordavisitor');
github accordproject / cicero / packages / cicero-tools / lib / codegen / codegen.js View on Github external
*
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

'use strict';

module.exports.AbstractPlugin = require('@accordproject/concerto-tools').CodeGen.AbstractPlugin;

module.exports.GoLangVisitor = require('@accordproject/concerto-tools').CodeGen.GoLangVisitor;
module.exports.JSONSchemaVisitor = require('@accordproject/concerto-tools').CodeGen.JSONSchemaVisitor;
module.exports.XmlSchemaVisitor = require('@accordproject/concerto-tools').CodeGen.XmlSchemaVisitor;
module.exports.PlantUMLVisitor = require('@accordproject/concerto-tools').CodeGen.PlantUMLVisitor;
module.exports.TypescriptVisitor = require('@accordproject/concerto-tools').CodeGen.TypescriptVisitor;
module.exports.JavaVisitor = require('@accordproject/concerto-tools').CodeGen.JavaVisitor;
module.exports.FileWriter = require('@accordproject/concerto-tools').FileWriter;

module.exports.CordaVisitor = require('./fromcto/corda/cordavisitor');
github accordproject / cicero / packages / cicero-tools / lib / codegen / codegen.js View on Github external
* distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

'use strict';

module.exports.AbstractPlugin = require('@accordproject/concerto-tools').CodeGen.AbstractPlugin;

module.exports.GoLangVisitor = require('@accordproject/concerto-tools').CodeGen.GoLangVisitor;
module.exports.JSONSchemaVisitor = require('@accordproject/concerto-tools').CodeGen.JSONSchemaVisitor;
module.exports.XmlSchemaVisitor = require('@accordproject/concerto-tools').CodeGen.XmlSchemaVisitor;
module.exports.PlantUMLVisitor = require('@accordproject/concerto-tools').CodeGen.PlantUMLVisitor;
module.exports.TypescriptVisitor = require('@accordproject/concerto-tools').CodeGen.TypescriptVisitor;
module.exports.JavaVisitor = require('@accordproject/concerto-tools').CodeGen.JavaVisitor;
module.exports.FileWriter = require('@accordproject/concerto-tools').FileWriter;

module.exports.CordaVisitor = require('./fromcto/corda/cordavisitor');
github accordproject / cicero / packages / cicero-tools / lib / codegen / codegen.js View on Github external
*
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

'use strict';

module.exports.AbstractPlugin = require('@accordproject/concerto-tools').CodeGen.AbstractPlugin;

module.exports.GoLangVisitor = require('@accordproject/concerto-tools').CodeGen.GoLangVisitor;
module.exports.JSONSchemaVisitor = require('@accordproject/concerto-tools').CodeGen.JSONSchemaVisitor;
module.exports.XmlSchemaVisitor = require('@accordproject/concerto-tools').CodeGen.XmlSchemaVisitor;
module.exports.PlantUMLVisitor = require('@accordproject/concerto-tools').CodeGen.PlantUMLVisitor;
module.exports.TypescriptVisitor = require('@accordproject/concerto-tools').CodeGen.TypescriptVisitor;
module.exports.JavaVisitor = require('@accordproject/concerto-tools').CodeGen.JavaVisitor;
module.exports.FileWriter = require('@accordproject/concerto-tools').FileWriter;

module.exports.CordaVisitor = require('./fromcto/corda/cordavisitor');