J'ai un xml contenant la description des classes que je veux générer avec la vitesse, sous cette forme:Erreur inattendue dans Apache fichier modèle Velocity
<Class name="name">
<Attribute name="name" type="typeName"/>
...
<Method name="name" type="typeName"/>
</Class>
Code de modèle est:
public class $class.Name implements NodeIface {
#foreach($att in $class.Attributes)
private $att.Type $att.name;
public $att.Type get$utility.firstToUpperCase($att.Name)() {
return this.$att.Name;
}
public void set$utility.firstToUpperCase($att.Name)($att.Type $att.Name) {
this.$att.Name = $att.Name;
}
#end
#foreach($mtd in $class.Methods)
if($class.Name == "name") {
public $mtd.Name() {
this.$att.Name = new $att.Type(Constants.SERVER_PORT, classNameHandler.class); //here lies the error
}
@Override
public $mtd.Type $mtd.Name() throws TException {
TSocket $att.Name = new TSocket("localhost", Constants.SERVER_PORT);
TBinaryProtocol $att.Name = new TBinaryProtocol($att.Name);
managementClient = new ManagementService.Client($att.Name);
this.setDispatcher(new OperationDispatcher($att.Name));
arithmeticServerTransport.open();
$att.Name.start();
$att.Name = new $att.Type($att.Name);
PortNegotiator negotiator = new PortNegotiator($att.Name);
negotiator.negotiate($att.Type, $att.Name);
}
@Override
public $mtd.Type $mtd.Name() {
$att.Name.stop();
}
}
else if ($class.Name == "GreetingsNode") {
public $mtd.Name();
this.$att.Name = new $att.Type((Constants.SERVER_PORT, GreetingsServiceHandler.class));
}
#Override
public $mtd.Type $mtd.Name() throws TException {
TSocket $att.Name = new TSocekt("localhost", Constants.SERVER_PORT);
TBinaryProtocol $att.Name = new TBinaryProtocol($att.Name);
$att.Name = new ManagementService.Client($att.Name);
this.SetUser(new User($att.Name);
this.setMessenger(new MessageDispatcher($att.Name));
$att.Name.open()
$att.Name = new $att.Type($att.Name);
PortNegotiator negotiator = new PortNegotiator($att.Name);
negotiator.negotiate($att.Type, $att.Name);
}
@Override
public $mtd.Type $mtd.Name() {
$att.Name.stop();
}
#End
L'éditeur de texte de la vitesse d'Eclipse m'indique qu'il y a une erreur avec ce message: "Rencontré"); \ r \ n \ t \ t \ n \ t \ t \ t \ t @ Remplacer \ r \ n \ t \ tpublic "à Class.vm [ligne 23, colonne 86] En attendait un de: " ["... " , "... ") "... ..."
Qu'est-ce que cela signifie?
Vous avez une méthode dans une instruction if et un Override sur rien –
vient d'ajouter la partie restante du code, désolé – Gaspare79