How to use the @accordproject/concerto-core.ModelUtil.getShortName function in @accordproject/concerto-core

To help you get started, we’ve selected a few @accordproject/concerto-core 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 / concerto / packages / concerto-tools / lib / codegen / fromcto / java / javavisitor.js View on Github external
let isAbstract = '';
        if(classDeclaration.isAbstract() ) {
            isAbstract = 'abstract ';
        }
        else {
            isAbstract = '';
        }

        let superType = '';

        if(classDeclaration.isSystemCoreType()) {
            superType = ' extends org.hyperledger.composer.system.Resource';
        }

        if(classDeclaration.getSuperType()) {
            superType = ' extends ' + ModelUtil.getShortName(classDeclaration.getSuperType());
        }

        this.plugin.addClassAnnotations(classDeclaration, parameters);
        parameters.fileWriter.writeLine(0, 'public ' + isAbstract + 'class ' + classDeclaration.getName() + superType + ' {' );

        // add the getID abstract type
        if(classDeclaration.getIdentifierFieldName()) {
            const getterName = 'get' + this.capitalizeFirstLetter(classDeclaration.getIdentifierFieldName());
            parameters.fileWriter.writeLine(1, `
   // the accessor for the identifying field
   public String getID() {
      return this.${getterName}();
   }
`
            );
        }
github accordproject / concerto / packages / concerto-tools / lib / codegen / fromcto / golang / golangvisitor.js View on Github external
visitClassDeclaration(classDeclaration, parameters) {
        parameters.fileWriter.writeLine(0, 'type ' + classDeclaration.getName() + ' struct {' );

        //embed the super-type, because Go Lang does not have 'extends'
        if(classDeclaration.getSuperType()) {
            parameters.fileWriter.writeLine(1, ModelUtil.getShortName(classDeclaration.getSuperType()));
        }

        classDeclaration.getOwnProperties().forEach((property) => {
            property.accept(this,parameters);
        });

        parameters.fileWriter.writeLine(0, '}' );
        return null;
    }
github accordproject / concerto / packages / concerto-tools / lib / codegen / fromcto / typescript / typescriptvisitor.js View on Github external
visitClassDeclaration(classDeclaration, parameters) {


        let isAbstract = '';
        if (classDeclaration.isAbstract()) {
            isAbstract = 'export abstract ';
        } else {
            isAbstract = 'export ';
        }

        let superType = '';
        if (classDeclaration.getSuperType()) {
            superType = ' extends ' + ModelUtil.getShortName(classDeclaration.getSuperType());
        }

        parameters.fileWriter.writeLine(1, isAbstract + 'class ' + classDeclaration.getName() + superType + ' {');

        classDeclaration.getOwnProperties().forEach((property) => {
            property.accept(this, parameters);
        });

        parameters.fileWriter.writeLine(1, '}');
        return null;
    }