use of com.fasterxml.jackson.databind.type.CollectionLikeType in project assembly64fx by freabemania.
the class ArtifactsService method getLatestVersion.
public String getLatestVersion(File db) {
try {
ObjectMapper mapper = getObjectMapper();
CollectionLikeType constructCollectionLikeType = mapper.getTypeFactory().constructCollectionLikeType(List.class, String.class);
List<String> versions = mapper.readValue(FileUtils.readFileToString(db), constructCollectionLikeType);
return versions.get(0);
} catch (Exception e) {
return null;
}
}
use of com.fasterxml.jackson.databind.type.CollectionLikeType in project assembly64fx by freabemania.
the class LocalDBService method getWorkLocations.
public List<WorkLocation> getWorkLocations(boolean forceUpdate) throws RuntimeException {
if (workLocations != null && !forceUpdate) {
return workLocations;
}
try {
File file = pathService.getWorkLocationsFile();
// bootstrap file
if (!file.exists()) {
storeWorkLocations(new ArrayList<>());
}
CollectionLikeType constructCollectionType = getObjectMapper().getTypeFactory().constructCollectionLikeType(ArrayList.class, WorkLocation.class);
this.workLocations = getObjectMapper().readValue(FileUtils.readFileToString(file), constructCollectionType);
return workLocations;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations