i have a interface like this:
在此输入代码...
public interface Enumerable {
 // some methods 
}

and i make my enums implements it , like this :
在此输入代码...

public enum UserStatusEnum implements Enumerable {
 // some fields & some methods
}



在此输入代码...

// this my customer deserializer

public class EnumDeserializer<E extends Enumerable> extends StdDeserializer<E> {

    private Class<E> enumType;

    public EnumDeserializer(Class<E> enumType) {
        super(enumType);
        this.enumType = enumType;
    }

    @Override
    public E deserialize(JsonParser jsonParser, DeserializationContext 
deserializationContext) throws IOException {
        return EnumUtil.of(this.enumType, jsonParser.getIntValue());
    }

}

// then , i config  MappingJackson2HttpMessageConverter

SimpleModule customerModule = new SimpleModule();

// this setup can be work

customerModule.addDeserializer(UserStatusEnum.class, new 
EnumDeserializer(UserStatusEnum.class));
// this setup not work 

customerModule.addDeserializer(Enumerable.class, new 
EnumDeserializer(Enumerable.class));


who can tell me what's up ? thank you very much.  and ,  this my project in 
github : https://github.com/Shiyajian/pretty-boot-demo.git 
<https://github.com/Shiyajian/pretty-boot-demo.git>
  <https://github.com/Shiyajian/pretty-boot-demo.git>

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to