Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [comment encoding = UTF-8 /]
- [module generate('http://www.eclipse.org/uml2/5.0.0/UML')/]
- [import org::eclipse::acceleo::module::sample::services::uml2services /]
- [template public generate(aClass : Class)]
- [file (aClass.classFileName(),false)]
- package [aClass.containingPackages().name->sep('.')/]
- //[protected ('imports')]
- // [/protected]
- public class [aClass.name.toUpperFirst()/] {
- [for (p: Property | aClass.attribute) separator('\n')]
- private [p.type.name/] [p.name/];
- [/for]
- [for (p: Property | aClass.attribute) separator('\n')]
- public [p.type.name/] get[p.name.toUpperFirst()/]() {
- return this.[p.name/];
- }
- [/for]
- [for (o: Operation | aClass.ownedOperation) separator('\n')]
- public [o.type.name/] [o.name/]() {
- //[protected (o.name)]
- // TODO should be implemented
- //[/protected]
- }
- [/for]
- }
- [/file]
- [/template]
- [query public classFileName(aClass : Class) : String =
- aClass.qualifiedName().replaceAll('\\.', '/').concat('.java')
- /]
- [query public qualifiedName(aClass : Class) : String =
- aClass.containingPackages().name->sep('.')->including('.')->including(aClass.name)->toString()
- /]
- [query public containingPackages(aClass : Class) : Sequence(Package) =
- aClass.ancestors(Package)->reject(oclIsKindOf(Model))->reverse()
- /]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement