use of org.commonjava.indy.pkg.npm.model.Directories in project indy by Commonjava.
the class VersionMetadataDeserializer method deserialize.
@Override
public VersionMetadata deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
final ObjectMapper mapper = (ObjectMapper) jsonParser.getCodec();
final JsonNode vNode = mapper.readTree(jsonParser);
VersionMetadata vm = new VersionMetadata(parseValue(vNode, "name"), parseValue(vNode, "version"));
vm.setDescription(parseValue(vNode, "description"));
JsonNode repoNode = vNode.get("repository");
if (repoNode instanceof ArrayNode) {
repoNode = repoNode.get(0);
}
vm.setRepository(new Repository(parseValue(repoNode, "type"), parseValue(repoNode, "url")));
vm.setAuthor(parseObject(mapper, vNode.get("author"), UserInfo.class));
vm.setBugs(parseObject(mapper, vNode.get("bugs"), Bugs.class));
vm.setDist(parseObject(mapper, vNode.get("dist"), Dist.class));
vm.setDirectories(parseObject(mapper, vNode.get("directories"), Directories.class));
vm.setKeywords(parseList(mapper, vNode.get("keywords"), String.class));
vm.setLicense(parseObject(mapper, vNode.get("license"), License.class));
vm.setMain(parseValue(vNode, "main"));
vm.setUrl(parseValue(vNode, "url"));
vm.setContributors(parseList(mapper, vNode.get("contributors"), UserInfo.class));
vm.setEngines(parseList(mapper, vNode.get("engines"), Engines.class));
vm.setDependencies(parseObject(mapper, vNode.get("dependencies"), Map.class));
vm.setDevDependencies(parseObject(mapper, vNode.get("devDependencies"), Map.class));
vm.setMaintainers(parseList(mapper, vNode.get("maintainers"), UserInfo.class));
vm.setLicenses(parseList(mapper, vNode.get("licenses"), License.class));
vm.setScripts(parseObject(mapper, vNode.get("scripts"), Map.class));
return vm;
}
Aggregations