[comment encoding = UTF-8 /] [module generate('http://www.example.org/pfe','http://www.eclipse.org/emf/2002/Ecore')/] [template public generateElement(aEClass : InteractionSpatiale)] [comment @main/] [file (aEClass.name.concat('.java'), false, 'UTF-8')] public class [aEClass.name/] { [for (aEAttribute : ecore :: EAttribute | eEClass.getAllAttributes())] [aEAttribute.eType.instanceClassName/] [aEAttribute.name/]; [/for] } [/file] [/template]
Cannot find operation (getAllAttributes()) for the type (InteractionSpatiale)
But since you seem to be attempting to rewrite the EMF JET templates that have been rewritten in Acceleo already, I suggest that you make very sure that you do not want to use the JET templates that are supported and well tested, else learn from the stale Acceleo variants.
[comment encoding = UTF-8 /] [module generate('http://www.example.org/pfe')/] [template public generateElement(myinteractionspatiale : InteractionSpatiale)] [comment @main/] [file (myinteractionspatiale.name.concat('.java'), false, 'UTF-8')] public class [myinteractionspatiale.name/] { [for (aEAttribute : ecore :: EAttribute | myinteractionspatiale.eClass().eAllAttributes)] [aEAttribute.eType.instanceClassName/] [aEAttribute.name/]; [/for] [for (aEReference : EReference |myinteractionspatiale.eClass().eAllReferences)] [aEReference.eReferenceType.name/] [aEReference.name/]; [/for] [for (aEAttribute : EAttribute | myinteractionspatiale.eClass().eAllAttributes)] public [aEAttribute.eType.instanceClassName/] get[aEAttribute.name.toUpperFirst()/] () { return this.[aEAttribute.name/]; } [/for] [for (aEAttribute : EAttribute | myinteractionspatiale.eClass().eAllAttributes)] public void set[aEAttribute.name.toUpperFirst()/] ([aEAttribute.eType.instanceClassName/] [aEAttribute.name/]) { this.[aEAttribute.name/] = [aEAttribute.name/]; } [/for] [for (aEReference : EReference | myinteractionspatiale.eClass().eAllReferences)] public [aEReference.eReferenceType.name/] get[aEReference.name.toUpperFirst()/] () { return this.[aEReference.name/]; } [/for] [for (aEReference : EReference | myinteractionspatiale.eClass().eAllReferences)] public void set[aEReference.name.toUpperFirst()/] ([aEReference.eReferenceType.name/] [aEReference.name/]) { this.[aEReference.name/] = [aEReference.name/];} [/for] [for (aEOperation : EOperation | myinteractionspatiale.eClass().eAllOperations)] public [aEOperation.eType.instanceClassName/] [aEOperation.name/] () { } [/for] } [/file] [/template]
public class App { java.lang.String name; Entite entite; Evenement evenement; SystemeCoordonnees systemecoordonnees; TacheSysteme tachesysteme; RelationSpatiale relationspatiale; InteractionSpatiale interactionspatiale; public java.lang.String getName () { return this.name; } public void setName (java.lang.String name) { this.name = name; } public Entite getEntite () { return this.entite; } public Evenement getEvenement () { return this.evenement; } public SystemeCoordonnees getSystemecoordonnees () { return this.systemecoordonnees; } public TacheSysteme getTachesysteme () { return this.tachesysteme; } public RelationSpatiale getRelationspatiale () { return this.relationspatiale; } public InteractionSpatiale getInteractionspatiale () { return this.interactionspatiale; } public void setEntite (Entite entite) { this.entite = entite; } public void setEvenement (Evenement evenement) { this.evenement = evenement; } public void setSystemecoordonnees (SystemeCoordonnees systemecoordonnees) { this.systemecoordonnees = systemecoordonnees; } public void setTachesysteme (TacheSysteme tachesysteme) { this.tachesysteme = tachesysteme; } public void setRelationspatiale (RelationSpatiale relationspatiale) { this.relationspatiale = relationspatiale; } public void setInteractionspatiale (InteractionSpatiale interactionspatiale) { this.interactionspatiale = interactionspatiale; } }
[aEAttribute->any(true).value /]
<?xml version="1.0" encoding="UTF-8"?> <pfe:InteractionSpatiale xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pfe="http://www.example.org/pfe" name="App"> <entite xsi:type="pfe:EFixe" Applied="//@relationspatiale.0" Position_Absolue="20" Orientation_Absolue="12" evenement="//@evenement.0"/> <entite xsi:type="pfe:EMobile" Applied="//@relationspatiale.0" Position_Absolue="30" Orientation_Absolue="20" evenement="//@evenement.0" VitesseDeplacementAbs="48" VitesseRotationAbs="70" AccelerationDeplacementAbs="12" AccelerationRotationAbs="11"/> <evenement xsi:type="pfe:EvenEMobileEFixe" name="Separate" Cause="//@tachesysteme.0"/> <tachesysteme name="Play"/> <relationspatiale PositionRelative="14" OrientationRelative="14" DistanceRelative="12" evenement="//@evenement.0"/> </pfe:InteractionSpatiale>
public class EFixe { int Position_Absolue =20 ;
= [myInteractionSpatiale.eGet(aEAttribute)/]
public class EFixe{ int Position_Absolue = 20; int Orientation_Absolue = 12; }
[ myInteractionSpatiale.eContents().eClass().name ]
EFixeEMobileEvenEMobileEFixeTacheSystemeRelationSpatiale
[myInteractionSpatiale.eContents().eClass().name->any(str | str = 'EFixe')/]
EFixe
[generateEntiteFixe (myInteractionSpatiale.eContents().eClass().name->any(str | str = 'EFixe')/]