edu.isi.nlp.serialization.jackson.JacksonUtils Maven / Gradle / Ivy
The newest version!
package edu.isi.nlp.serialization.jackson;
import com.fasterxml.jackson.databind.Module;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import java.util.List;
public final class JacksonUtils {
private JacksonUtils() {
throw new UnsupportedOperationException();
}
private static final Supplier> discoveredModules =
Suppliers.memoize(
new Supplier>() {
@Override
public List get() {
return ObjectMapper.findModules();
}
});
/**
* Caches the results of {@link com.fasterxml.jackson.databind.ObjectMapper#findModules()}. Note
* that if the classes available to your application change after the first call to these, the
* returned list will be incorrect.
*/
public static synchronized Supplier> discoverModulesWithCaching() {
return discoveredModules;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy