This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.rest.api.covid19.domain; | |
import com.fasterxml.jackson.annotation.JsonInclude; | |
import com.fasterxml.jackson.annotation.JsonProperty; | |
import lombok.Data; | |
@Data | |
@JsonInclude(JsonInclude.Include.NON_NULL) | |
public class Global { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.rest.api.covid19.domain; | |
import com.fasterxml.jackson.annotation.JsonInclude; | |
import com.fasterxml.jackson.annotation.JsonProperty; | |
import lombok.Data; | |
import java.util.List; | |
@Data | |
@JsonInclude(JsonInclude.Include.NON_NULL) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Global": { | |
"NewConfirmed": 257886, | |
"TotalConfirmed": 17849120, | |
"NewDeaths": 5615, | |
"TotalDeaths": 685038, | |
"NewRecovered": 222627, | |
"TotalRecovered": 10552934 | |
}, | |
"Countries": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<String> list = new ArrayList<String>(); | |
list.add("hello"); | |
list.add(32);//Compile Time Error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<String> list = new ArrayList<String>(); | |
list.add("hello"); | |
String s = list.get(0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List list = new ArrayList(); | |
list.add("hello"); | |
String s = (String) list.get(0);//typecasting |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<Integer> list = new ArrayList<Integer>(); | |
list.add(10); | |
list.add("10");// compile-time error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List list = new ArrayList(); | |
list.add(10); | |
list.add("10"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ControllerAdvice | |
@CrossOrigin | |
public class ExceptionHandlerController { | |
@ExceptionHandler({ClientUnavailableException.class}) | |
public ResponseEntity<ErrorAndCodeResponse> badRequest(BackendException e) { | |
ErrorAndCodeResponse error = new ErrorAndCodeResponse(e.getCode().name(), e.getCode().getMessage(), e.getAdditionalInfo()); | |
return new ResponseEntity<>(error, HttpStatus.BAD_REQUEST); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Agreement getById(Integer id) throws BackendException { | |
try { | |
AgreementDto agreementDto = this.agreementClientService.get(id); | |
return mapper.map(agreementDto, Agreement.class); | |
} catch (ResourceAccessException e) { | |
throw new CatalogClientUnavailableException(); | |
} catch (CatalogException e) { | |
throw new ResourceNotFoundException(id, "Agreement"); | |
} | |
} |