我有一个包含我想与速度生成类的描述的XML,在这种形式:意外错误
<Class name="name">
<Attribute name="name" type="typeName"/>
...
<Method name="name" type="typeName"/>
</Class>
模板的代码是:
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
Eclipse的速度文本编辑器告诉我这条消息有错误:“Encountered”); \ r \ n \ t \ t} \ r \ n \ t \ t \ r \ n \ t \ t @ Override \ r \ n't \ tpublic“在Class.vm [第23行,第86列] 期待以下之一: ”[“... ” ,“... ”)“... ...”
这是什么意思?
你有一个if语句中的方法和一个无所谓的覆盖 –
刚刚添加了代码的其余部分,对不起 – Gaspare79