Skip to content
This repository was archived by the owner on Jan 22, 2019. It is now read-only.
This repository was archived by the owner on Jan 22, 2019. It is now read-only.

Impossible to turn off Alphanumeric Sort for bean properties #40

@dmitry87

Description

@dmitry87
package com.fasterxml.jackson.dataformat.csv;
....
public class CsvFactory extends JsonFactory{
.....
 // Yes; CSV is positional
  @Override
    public boolean requiresPropertyOrdering() {
        return true;
    }
....
}

Because of this code AlphanumericSort is set twice. In ObjectMapper

public ObjectMapper(JsonFactory jf,
            DefaultSerializerProvider sp, DefaultDeserializationContext dc)
    {
....
        final boolean needOrder = _jsonFactory.requiresPropertyOrdering();
        if (needOrder ^ _serializationConfig.isEnabled(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY)) {
            configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, needOrder);
        }

....        
    }

and in CsvMapper

public CsvMapper(CsvFactory f)
    {
        super(f);
        // As per #11: default to alphabetic ordering
        enable(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY);
    }

so it's impossible to turn it off. Probably SORT must be applied once or made pluggable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions