Example usage for com.fasterxml.jackson.databind MapperFeature enabledByDefault

List of usage examples for com.fasterxml.jackson.databind MapperFeature enabledByDefault


In this page you can find the example usage for com.fasterxml.jackson.databind MapperFeature enabledByDefault.


public boolean enabledByDefault() 

Source Link


From source file:org.jberet.support.io.MappingJsonFactoryObjectFactory.java

static void configureMapperFeatures(final ObjectMapper objectMapper, final String features) {
    final StringTokenizer st = new StringTokenizer(features, ",");
    while (st.hasMoreTokens()) {
        final String[] pair = NoMappingJsonFactoryObjectFactory.parseSingleFeatureValue(st.nextToken().trim());
        final String key = pair[0];
        final String value = pair[1];

        final MapperFeature feature;
        try {/*ww  w.ja  v a2  s.c  o m*/
            feature = MapperFeature.valueOf(key);
        } catch (final Exception e1) {
            throw SupportMessages.MESSAGES.unrecognizedReaderWriterProperty(key, value);
        if ("true".equals(value)) {
            if (!feature.enabledByDefault()) {
                objectMapper.configure(feature, true);
        } else if ("false".equals(value)) {
            if (feature.enabledByDefault()) {
                objectMapper.configure(feature, false);
        } else {
            throw SupportMessages.MESSAGES.invalidReaderWriterProperty(null, value, key);