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

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


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


public boolean enabledByDefault() 

Source Link


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

static void configureSerializationFeatures(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 SerializationFeature feature;
        try {/*from w  w w.  ja  v  a  2 s.co m*/
            feature = SerializationFeature.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);