Skip to content

Commit 30c1872

Browse files
REFACTOR: minor format code with intellij code
1 parent 4a6eea1 commit 30c1872

File tree

3 files changed

+26
-26
lines changed

3 files changed

+26
-26
lines changed

src/main/java/com/people23/person/PersonApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
@SpringBootApplication
1010
@EnableJpaAuditing
1111
public class PersonApplication {
12-
12+
1313
public static void main(String[] args) {
1414
SpringApplication.run(PersonApplication.class, args);
1515
}

src/main/java/com/people23/person/controller/PersonController.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ public class PersonController {
2020

2121
@Autowired
2222
PersonRepository personRepository;
23-
23+
2424
@GetMapping("/persons")
2525
public List<Person> getAllPersons() {
2626
return personRepository.findAll();
2727
}
2828

2929
@GetMapping("/persons/{id}")
3030
public Person getPersonById(@PathVariable(value = "id") Long id) {
31-
return personRepository.findById(id)
32-
.orElseThrow(() -> new PersonNotFoundException("Person", "id", id));
31+
return personRepository.findById(id)
32+
.orElseThrow(() -> new PersonNotFoundException("Person", "id", id));
3333
}
34-
34+
3535
@PostMapping("/persons")
3636
public Person createPerson(@Valid @RequestBody Person person) {
3737
return personRepository.save(person);
@@ -42,7 +42,7 @@ public Person updatePerson(@PathVariable(value = "id") Long id, @Valid @RequestB
4242

4343
Person person = personRepository.findById(id)
4444
.orElseThrow(() -> new PersonNotFoundException("Person", "id", id));
45-
45+
4646
person.setFirstName(personDetails.getFirstName());
4747
person.setLastName(personDetails.getLastName());
4848

@@ -52,10 +52,10 @@ public Person updatePerson(@PathVariable(value = "id") Long id, @Valid @RequestB
5252

5353
@DeleteMapping("/persons/{id}")
5454
public ResponseEntity<Person> deletePerson(@PathVariable(value = "id") Long id) {
55-
55+
5656
Person person = personRepository.findById(id)
5757
.orElseThrow(() -> new PersonNotFoundException("Person", "id", id));
58-
58+
5959
personRepository.delete(person);
6060
return ResponseEntity.ok().build();
6161
}

src/main/java/com/people23/person/exception/PersonNotFoundException.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@
55

66
@ResponseStatus(value = HttpStatus.NOT_FOUND)
77
public class PersonNotFoundException extends RuntimeException {
8-
private String personName;
9-
private String fieldName;
10-
private Object fieldValue;
8+
private String personName;
9+
private String fieldName;
10+
private Object fieldValue;
1111

12-
public PersonNotFoundException( String personName, String fieldName, Object fieldValue) {
13-
super(String.format("%s not found with %s : '%s'", personName, fieldName, fieldValue));
14-
this.personName = personName;
15-
this.fieldName = fieldName;
16-
this.fieldValue = fieldValue;
17-
}
12+
public PersonNotFoundException(String personName, String fieldName, Object fieldValue) {
13+
super(String.format("%s not found with %s : '%s'", personName, fieldName, fieldValue));
14+
this.personName = personName;
15+
this.fieldName = fieldName;
16+
this.fieldValue = fieldValue;
17+
}
1818

19-
public String getPersonName() {
20-
return personName;
21-
}
19+
public String getPersonName() {
20+
return personName;
21+
}
2222

23-
public String getFieldName() {
24-
return fieldName;
25-
}
23+
public String getFieldName() {
24+
return fieldName;
25+
}
2626

27-
public Object getFieldValue() {
28-
return fieldValue;
29-
}
27+
public Object getFieldValue() {
28+
return fieldValue;
29+
}
3030
}

0 commit comments

Comments
 (0)