Package dev.zemco.codegame.problems
Class UrlObjectMapperProblemRepository
java.lang.Object
dev.zemco.codegame.problems.UrlObjectMapperProblemRepository
- All Implemented Interfaces:
IProblemRepository
- Author:
- Erik Zemčík
- See Also:
-
ObjectMapper
-
Constructor Summary
ConstructorsConstructorDescriptionUrlObjectMapperProblemRepository(URL url, com.fasterxml.jackson.databind.ObjectMapper objectMapper) Creates an instance ofUrlObjectMapperProblemRepository. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves and deserializes all problems from theURLdatasource.
-
Constructor Details
-
UrlObjectMapperProblemRepository
public UrlObjectMapperProblemRepository(URL url, com.fasterxml.jackson.databind.ObjectMapper objectMapper) Creates an instance ofUrlObjectMapperProblemRepository.- Parameters:
url- resource to use as a constant data sourceobjectMapper- object mapper to use for deserialization- Throws:
IllegalArgumentException- ifurlisnullor ifobjectMapperisnull
-
-
Method Details
-
getAllProblems
Retrieves and deserializes all problems from theURLdatasource.- Specified by:
getAllProblemsin interfaceIProblemRepository- Returns:
- unmodifiable
listof problems - Throws:
ResourceLoadException- if retrieval or deserialization fails
-