com.files.util.ModelUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of files-sdk Show documentation
Show all versions of files-sdk Show documentation
The Files.com Java client library provides convenient access to the Files.com API from JVM based applications.
package com.files.util;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.json.JsonMapper;
import java.util.HashMap;
public class ModelUtils {
private ModelUtils() {
}
public static HashMap toParameterMap(String object) {
ObjectMapper mapper = JsonMapper
.builder()
.disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS)
.build();
TypeReference> typeRef = new TypeReference>() {};
HashMap parameters;
try {
parameters = mapper.readValue(object, typeRef);
} catch (JsonProcessingException e) {
parameters = null;
}
return parameters;
}
public static String forceMandatoryUriEncode(String uri) {
return uri.replaceAll(";", "%3B");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy