3
我一直在嘗試生成如下的Java彈簧代碼。Xtext&Xtend - 向RequestMapping添加更多參數
@RequestMapping(method=RequestMethod.DELETE, value="/message/{id}")
public void reject(@PathVariable final Long id) {
return;
}
我在xtend文件中提供了下面的代碼。
members += event.toMethod(event.action.name, typeRef(void)) [
var dataType = map.get(method.action.name)
parameters += event.toParameter(method.type.parameter.name, dataType.javaType) => [
annotations += annotationRef("org.springframework.web.bind.annotation.PathVariable");
]
annotations += annotationRef("org.springframework.web.bind.annotation.RequestMapping", "method=RequestMethod.DELETE", "/message/{id}");
body = '''
return;
'''
]
和我得到的輸出是
@RequestMapping({ "method=RequestMethod.DELETE", "/message/{id}" })
public void reject(@PathVariable final Long id) {
return;
}
我很困惑如何提供XTEND代碼,使我能得到RequestMapping格式@RequestMapping(method=RequestMethod.DELETE, value="/message/{id}")