net.jangaroo.apprunner.util.AppDeSerializer Maven / Gradle / Ivy
package net.jangaroo.apprunner.util;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collections;
import java.util.List;
import java.util.Map;
public class AppDeSerializer {
private static final String LOCALES_PROPERTY = "locales";
private static final List DEFAULT_LOCALES = Collections.singletonList("en");
public static List readLocales(InputStream appJsonSource) throws IOException {
//noinspection unchecked
Map map = new ObjectMapper().readValue(appJsonSource, Map.class);
if (map.containsKey(LOCALES_PROPERTY)) {
//noinspection unchecked
return (List) map.get(LOCALES_PROPERTY);
}
return DEFAULT_LOCALES;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy