Thanks for help :) I couldn't figured out working solution with 
BasicDesrializerFactory usage. If anyone in the future will have the same 
problem: I resolved it by creating factory for custom enum deserializers 
which return if enum value not found error with specific message (error 
value: xx , required values: [x,y,z] ). Code with generic enum deserializer 
is a little bit weird but it works.

W dniu środa, 6 lutego 2019 06:24:10 UTC+1 użytkownik Tatu Saloranta 
napisał:
>
> On Tue, Feb 5, 2019 at 2:40 PM <[email protected] <javascript:>> wrote: 
> > 
> > Hello, 
> > 
> > how can I get StdDeserializer for Enum (in general)?  For numbers and 
> String I found as NumberDeserializer.ShortDeserializer  etc. and new 
> StringDeserializer(). 
> > Purpose of using is described e.g in topic 
> https://stackoverflow.com/questions/9080904/jackson-deserialization-error-handling.
>  
> I want to get full report of error founded during deserialization. 
> > 
> > According to post above my code looks like 
> >> 
> >> 
> >> JacksonNonBlockingObjectMapperFactory factory = new 
> JacksonNonBlockingObjectMapperFactory(); 
> >> factory.setJsonDeserializers( 
> >> Arrays.asList(new StdDeserializer[] { new 
> NumberDeserializers.IntegerDeserializer(Integer.class, null), 
> >> new NumberDeserializers.ShortDeserializer(Short.class, null), 
> >> new NumberDeserializers.DoubleDeserializer(Double.class, null), 
> >> new NumberDeserializers.LongDeserializer(Long.class, null), 
> >> new NumberDeserializers.BigDecimalDeserializer(), new 
> StringDeserializer() } 
> >> )); 
>
> Many Jackson's internal deserializers are not designed to be usable 
> this way: the reason they are not simply usable by creating an 
> instance is that there's quite a bit of initialization by various 
> configuration settings, handled through callbacks (necessary to deal 
> with recursive types, caching). 
> But if you want to try making it work nonetheless, class would be 
> `EnumDeserializer`, instance created by `BasicDeserializerFactory`; 
> you may be able to copy code from there. 
>
> Usually the way to access standard deserializers is to either access 
> them via `DeserializationContext`, during deserialization or by 
> registering BeanDeserializerModifier which gives you default 
> deserializer instance that has been created, and you can then swap 
> your own implementation. 
> I am not sure if that would work for your use case or not. 
>
> -+ Tatu +- 
>

-- 
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