Skip to content

Commit

Permalink
Remove unnecessary path attribute in mapping annotations
Browse files Browse the repository at this point in the history
Since only path is specified in the mapping annotation, it can be omitted.
  • Loading branch information
drumonii committed Nov 1, 2019
1 parent 3ec500a commit 81bdc64
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 30 deletions.
Expand Up @@ -73,7 +73,7 @@ public Page<Build> getBuilds(
* @return the {@link Build}
*/
@JsonView({ ApiViews.LtbApi.class })
@GetMapping(path = "/{id}")
@GetMapping("/{id}")
public Build getBuild(@PathVariable int id) {
Optional<Build> optionalBuild = buildsRepository.findById(id);
if (optionalBuild.isEmpty()) {
Expand Down Expand Up @@ -127,7 +127,7 @@ public ResponseEntity<Build> saveBuild(@RequestBody @Valid Build build, BindingR
*
* @return the count of saved {@link Build}s
*/
@GetMapping(path = "/count")
@GetMapping("/count")
public long countBuilds() {
return buildsRepository.count();
}
Expand Down
Expand Up @@ -75,7 +75,7 @@ public List<Champion> getChampions(
* @return the {@link Champion}
*/
@JsonView(ApiViews.LtbApi.class)
@GetMapping(path = "/{value}")
@GetMapping("/{value}")
public Champion getChampion(@PathVariable String value) {
return championsApiService.find(value)
.orElseThrow(() -> new ResourceNotFoundException("Unable to find a Champion with value: " + value));
Expand All @@ -86,7 +86,7 @@ public Champion getChampion(@PathVariable String value) {
*
* @return the {@link List} of tags
*/
@GetMapping(path = "/tags")
@GetMapping("/tags")
public List<String> getTags() {
return championsApiService.getTags();
}
Expand All @@ -99,7 +99,7 @@ public List<String> getTags() {
* @return a {@link Map} of build type key with {@link List} of values.
*/
@JsonView(ApiViews.LtbApi.class)
@GetMapping(path = "/{value}/troll-build")
@GetMapping("/{value}/troll-build")
public TrollBuild trollBuild(@PathVariable String value,
@RequestParam(required = false, defaultValue = SUMMONERS_RIFT_SID) int mapId) {
Champion champion = championsApiService.find(value)
Expand Down
Expand Up @@ -23,32 +23,32 @@ public class ImagesRestController {
@Autowired
private ImageApiService imageApiService;

@GetMapping(path = "/summoner-spells/{id}")
@GetMapping("/summoner-spells/{id}")
public ResponseEntity<byte[]> summonerSpellImg(@PathVariable("id") int summonerSpellId) {
return createResponseEntity(imageApiService.getSummonerSpellImage(summonerSpellId));
}

@GetMapping(path = "/items/{id}")
@GetMapping("/items/{id}")
public ResponseEntity<byte[]> itemImg(@PathVariable("id") int itemId) {
return createResponseEntity(imageApiService.getItemImage(itemId));
}

@GetMapping(path = "/champions/{id}")
@GetMapping("/champions/{id}")
public ResponseEntity<byte[]> championImg(@PathVariable("id") int championId) {
return createResponseEntity(imageApiService.getChampionImage(championId));
}

@GetMapping(path = "/champions/{id}/spell/{spellKey}")
@GetMapping("/champions/{id}/spell/{spellKey}")
public ResponseEntity<byte[]> championSpellImg(@PathVariable("id") int championId, @PathVariable String spellKey) {
return createResponseEntity(imageApiService.getChampionSpellImage(championId, spellKey));
}

@GetMapping(path = "/champions/{id}/passive")
@GetMapping("/champions/{id}/passive")
public ResponseEntity<byte[]> championPassiveImg(@PathVariable("id") int championId) {
return createResponseEntity(imageApiService.getChampionPassiveImage(championId));
}

@GetMapping(path = "/maps/{mapId}")
@GetMapping("/maps/{mapId}")
public ResponseEntity<byte[]> mapImg(@PathVariable int mapId) {
return createResponseEntity(imageApiService.getMapImage(mapId));
}
Expand Down
Expand Up @@ -59,7 +59,7 @@ public List<Item> getItems(
* @return the {@link Item}
*/
@JsonView(ApiViews.LtbApi.class)
@GetMapping(path = "/{id}")
@GetMapping("/{id}")
public Item getItem(@PathVariable int id) {
return itemsApiService.findById(id)
.orElseThrow(() -> new ResourceNotFoundException("Unable to find an Item with Id: " + id));
Expand All @@ -73,7 +73,7 @@ public Item getItem(@PathVariable int id) {
* @return the {@link List} of {@link Item}s
*/
@JsonView(ApiViews.LtbApi.class)
@GetMapping(path = "/boots")
@GetMapping("/boots")
public List<Item> getBoots(@RequestParam(required = false, defaultValue = SUMMONERS_RIFT_SID) int mapId) {
return itemsApiService.boots(mapId);
}
Expand All @@ -86,7 +86,7 @@ public List<Item> getBoots(@RequestParam(required = false, defaultValue = SUMMON
* @return the {@link List} of {@link Item}s
*/
@JsonView(ApiViews.LtbApi.class)
@GetMapping(path = "/trinkets")
@GetMapping("/trinkets")
public List<Item> getTrinkets(@RequestParam(required = false, defaultValue = SUMMONERS_RIFT_SID) int mapId) {
return itemsApiService.trinkets(mapId);
}
Expand All @@ -98,7 +98,7 @@ public List<Item> getTrinkets(@RequestParam(required = false, defaultValue = SUM
* @return the {@link List} of {@link Item}s
*/
@JsonView(ApiViews.LtbApi.class)
@GetMapping(path = "/viktor-only")
@GetMapping("/viktor-only")
public List<Item> getViktorOnly() {
return itemsApiService.viktorOnly();
}
Expand Down
Expand Up @@ -58,7 +58,7 @@ public List<GameMap> getGameMaps(
* @return the {@link GameMap}
*/
@JsonView(ApiViews.LtbApi.class)
@GetMapping(path = "/{id}")
@GetMapping("/{id}")
public GameMap getGameMap(@PathVariable int id) {
return mapsApiService.findById(id)
.orElseThrow(() -> new ResourceNotFoundException("Unable to find a Map with Id: " + id));
Expand All @@ -71,7 +71,7 @@ public GameMap getGameMap(@PathVariable int id) {
* @return the {@link List} of {@link GameMap}s
*/
@JsonView(ApiViews.LtbApi.class)
@GetMapping(path = "/for-troll-build")
@GetMapping("/for-troll-build")
public List<GameMap> getForTrollBuild() {
return mapsApiService.forTrollBuild();
}
Expand Down
Expand Up @@ -56,7 +56,7 @@ public List<SummonerSpell> getSummonerSpells(
* @return the {@link SummonerSpell}
*/
@JsonView(ApiViews.LtbApi.class)
@GetMapping(path = "/{id}")
@GetMapping("/{id}")
public SummonerSpell getSummonerSpell(@PathVariable int id) {
return summonerSpellsApiService.findById(id)
.orElseThrow(() -> new ResourceNotFoundException("Unable to find a Summoner Spell with Id: " + id));
Expand All @@ -70,7 +70,7 @@ public SummonerSpell getSummonerSpell(@PathVariable int id) {
* @return the {@link List} of {@link SummonerSpell}s
*/
@JsonView(ApiViews.LtbApi.class)
@GetMapping(path = "/for-troll-build")
@GetMapping("/for-troll-build")
public List<SummonerSpell> getForTrollBuild(@RequestParam(required = false, defaultValue = "CLASSIC") GameMode mode) {
return summonerSpellsApiService.forTrollBuild(mode);
}
Expand Down
Expand Up @@ -49,7 +49,7 @@ public List<Version> getVersions(
* @param patch the patch to lookup the {@link Version}
* @return the {@link Version}
*/
@GetMapping(path = "/{patch}")
@GetMapping("/{patch}")
public Version getVersion(@PathVariable String patch) {
return versionsApiService.findById(patch)
.orElseThrow(() -> new ResourceNotFoundException("Unable to find a Version with patch: " + patch));
Expand All @@ -60,7 +60,7 @@ public Version getVersion(@PathVariable String patch) {
*
* @return the {@link Version}
*/
@GetMapping(path = "/latest")
@GetMapping("/latest")
public Version getLatestVersion() {
return Optional.ofNullable(versionsApiService.latestVersion())
.orElseThrow(() -> new ResourceNotFoundException("Unable to get the latest Version with no saved Versions"));
Expand Down
Expand Up @@ -23,7 +23,7 @@ public class AdminAuthenticationRestController {
* @param userDetails the {@link User}
* @return the {@link AdminUserDetails} if authenticated, otherwise {@code null}
*/
@GetMapping(path = "/authentication")
@GetMapping("/authentication")
public AdminUserDetails getAuthentication(@AuthenticationPrincipal User userDetails) {
User user = Optional.ofNullable(userDetails)
.orElseThrow(() -> new BadRequestException("Authentication was not found"));
Expand Down
Expand Up @@ -75,7 +75,7 @@ public Page<BatchJobInstance> getBatchJobInstances(
*
* @return the {@link ResponseEntity} of {@link BatchJobExecution} if successfully ran, otherwise a 500.
*/
@PostMapping(path = "/restart")
@PostMapping("/restart")
public ResponseEntity<BatchJobExecution> restartAllRetrievalsJob() {
JobParameters jobParameters = new JobParametersBuilder()
.addLong("forced", RandomizeUtil.getRandomLong())
Expand All @@ -97,7 +97,7 @@ public ResponseEntity<BatchJobExecution> restartAllRetrievalsJob() {
*
* @return the {@link Map} of "hasFailedAllRetrievalsJob" key and boolean value.
*/
@GetMapping(path = "/has-failed-all-retrievals-job")
@GetMapping("/has-failed-all-retrievals-job")
public Map<String, Boolean> hasFailedAllRetrievalsJob(@RequestParam(required = false, defaultValue = "5") long minutes) {
LocalDateTime lastStartTime = LocalDateTime.now().minusMinutes(minutes);

Expand Down Expand Up @@ -125,7 +125,7 @@ public Map<String, Boolean> hasFailedAllRetrievalsJob(@RequestParam(required = f
* @param jobInstanceId the job instance Id to lookup
* @return the {@link BatchJobInstance}
*/
@GetMapping(path = "/{jobInstanceId}")
@GetMapping("/{jobInstanceId}")
public BatchJobInstance getBatchJobInstance(@PathVariable long jobInstanceId) {
Optional<BatchJobInstance> jobInstance = batchJobInstancesRepository.findById(jobInstanceId);
return jobInstance.orElseThrow(() -> new ResourceNotFoundException("Unable to find Batch Job Instance with Id: " + jobInstanceId));
Expand Down
Expand Up @@ -47,7 +47,7 @@ public List<BatchStepExecution> getBatchStepExecutions(@PathVariable long jobIns
* @param stepExecutionId the step execution Id to lookup
* @return the {@link BatchStepExecution}
*/
@GetMapping(path = "/{stepExecutionId}")
@GetMapping("/{stepExecutionId}")
public BatchStepExecution getBatchStepExecution(@PathVariable long jobInstanceId,
@PathVariable long stepExecutionId) {
Optional<BatchStepExecution> stepExecution = batchStepExecutionsRepository.findById(stepExecutionId);
Expand Down
Expand Up @@ -18,7 +18,7 @@ public String builds() {
return "forward:/troll-build/index.html";
}

@GetMapping(path = "/{id}")
@GetMapping("/{id}")
public String build(@PathVariable int id) {
return "forward:/troll-build/index.html";
}
Expand Down
Expand Up @@ -18,7 +18,7 @@ public String champions() {
return "forward:/troll-build/index.html";
}

@GetMapping(path = "/{value}")
@GetMapping("/{value}")
public String champion(@PathVariable String value) {
return "forward:/troll-build/index.html";
}
Expand Down
Expand Up @@ -16,12 +16,12 @@ public String admin() {
return "forward:/admin/index.html";
}

@GetMapping(path = "/batch")
@GetMapping("/batch")
public String batch() {
return "forward:/admin/index.html";
}

@GetMapping(path = "/flyway")
@GetMapping("/flyway")
public String flyway() {
return "forward:/admin/index.html";
}
Expand Down

0 comments on commit 81bdc64

Please sign in to comment.