'Convert RestTemplate data when creating object

I am getting data from an API call using RestTemplate in Spring and then I am using the .getForEntity() method. My class that I am returning it as is called Stock and I have a field that is called timestamp which is of type Timestamp. The data in the API is just a Long. EX: 1599436300

How can I get the RestTemplate to create a new Timestamp object using that Long from the API whenever I call getForEntity()?

Currently it does nothing with the received timestamp value and just creates a default Timestamp object for each Stock.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source