samples/gen_again_java.ysl2
author Volker Birk <vb@pep-project.org>
Thu, 21 Jan 2021 01:46:34 +0100
changeset 70 58043c7bcc51
parent 0 76005e62091d
permissions -rw-r--r--
renamed in Python 3
include yslt.yml2

tstylesheet {
    template "/xmi:XMI/uml:Model" {
        apply "Package", 0;
    }

    template 'packagedElement[xmi:type="uml:Package"]' {
        | package «@name»;
        | 
        apply "packagedElement", 0;
    }

    template 'packagedElement[xmi:type="uml:Class"]' {
        | class «@name» {
        apply 'ownedAttribute[xmi:type="uml:Property"]';
        | }
    }

    template "Attribute" {
        |     // attribute «@name»
        | 
        |     public «type» get«@name»() {
        |         return «@name»;
        |     }
        | 
        |     public void set«@name»(«type» value) {
        |         «@name» = value;
        |     }
        | 
        |     private «type» «@name»;
    }
}