Skip to content

@JsonCreator not working on a factory with no arguments for ae enum type #960

@ajonkisz

Description

@ajonkisz

Using a singleton pattern as described here by Joshua Block results in IllegalArgumentException from BasicDeserializerFactory:1252. An example:

public enum  MyEnum {
    INSTANCE;

    @JsonCreator
    public static MyEnum getInstance() {
        return INSTANCE;
    }   
}

A dirty workaround is to add an ignored parameter like:

@JsonCreator
public static MyEnum getInstance(String ignored) {
    return INSTANCE;
}

This issue is related to issue 929

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions