Trying to do a structural find and replace
已回答
I want to rename my @RequestMapping annotations to @GetMapping, @PutMapping ... annotations.
I tried adding the following in the search
@RequestMapping( $key$ = $value$)
Added a filter on the key. text=method
Now I want to extract the from the value (RequestMethod.GET) , the word after . (period). and then in the replacement add
@[Word]Mapping( [everything except the key,value that was extracted in the search])
Is this possible in IntelliJ using structural replace without having to write a custom plugin?
请先登录再写评论。
This is currently not supported by Structural Search and Replace, because of a bug. Follow the issue to get a notification when it is fixed.
Bas
Hi. Could you please provide example of original string and a string after the replace?
Here is an example of before and after:
Before:
After:
@PostMapping(value = "/channels/{channel_name}",
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
public Channel updateChannel(
@PathVariable("channel_name") String channelName,
@Valid @RequestBody Channel channel) {
return channelService.updateChannel(channelName, channel);
}
@DeleteMapping(
value = "/channels/{channel_name}",
produces = MediaType.APPLICATION_JSON_VALUE)
public Channel deleteChannel(
@PathVariable("channel_name") String channelName) {
return channelService.deleteChannel(channelName);
}
Hi.
This is currently not supported by Structural Search and Replace, because of a bug. Follow the issue to get a notification when it is fixed.
Bas
Is this still not supported? If so, making intellij plugin is the only valid way for now?