Unable to use getObjectMapper in getStockQuote() function

Todo’s instruction

// Logic to read Json file and convert them into Objects will not be required further as our
// clients will take care of it, going forward.

In order to extract data I need to use getObjectMapper() in getStockQuote(…) function, but it is showing me error here, I have made sure that required packages are imported,
c4

error: The method getObjectMapper() is undefined for the type PortfolioManagerImplJava(67108964)

if I will not use it than how am I going to get required data, what above lines of todo’s mean, shouldn’t I use getObjectMapper, if not than hint me specific section from where I will get functionality same as getObjectMapper(…), and how their crio’s client is going to take care of it, please guide,

You need not extract data from json file now.
See the return type of getStockQuote() and you will see what has to be returned.
Understand why you would use this function, read these TODOs again

// TODO: CRIO_TASK_MODULE_REFACTOR
// Extract the logic to call Tiingo thirdparty APIs to a separate function.
// It should be split into fto parts.
// Part#1 - Prepare the Url to call Tiingo based on a template constant,
// by replacing the placeholders.

Hope it helps !

2 Likes

u didn’t get it , I understood from return type what needs to be done but in function getStockQuote() while using objectMapper function I am getting error: The method getObjectMapper() is undefined for the type PortfolioManagerImplJava, are we supposed to use objectMapper here or not, ?

Yes just copy-paste objectMapper() function from PortfolioManagerApplication to PortfolioManagerImpl.java file.

1 Like

Thanks a lot :slight_smile:
one more question do we need to implement readFileAsString(String) from scratch in required class as I am getting error as it is undefined or it too needs to be arranged from somewhere @akashchhetri

You have to implement it. Google this you will find various solutions. Use one of them

1 Like

You did it in previous module, and you need not necassarily use readFileAsString(file) to resolve the file name.
Just use the technique you used in previous module.

1 Like

Hey @Priyanka488 thanks already done that, may u clear my one doubt this my doubt link this if you can clearify it my prime cocern at the moment is how to get rid of error in as I am getting error in portfolioManager
portfolioManager.calculateAnnualizedReturn(Arrays.asList(portfolioTrades), endDate);
}

I am still wondering why you used ObjectMapper in getStockQuotes().
It was not required, since “Logic to read Json file and convert them into Objects will not be required further as our clients will take care of it, going forward.”

and if you may remember ObjectMapper() was used to read objects from JSON file.

1 Like

Hey @divs30 did you find any answers to get portfolioManager?