Sorry about the bad explanation, so here's the small part of my custom
AnnotationInspector.
public class DocumentAnnotationIntrospector extends NopAnnotationIntrospector {
@Override
public Object findInjectableValueId( AnnotatedMember annotatedMember ) {
// let's say, annotationMember value is BaseFoo#version and I want to
get the actual class (Bar) of that object not the parent (BaseFoo)
Class<?> declaringClass = annotatedMember.getDeclaringClass(); // here it
returns parent class not the sub-class(Bar) that type of object.
return null;
}
}
When deserializing the Bar object (from above example) - all annotated
fields go through the `findInjectableValueId ()` method of my custom
annotation inspector. And in v2.5, there're used to be
annotatedMember.getContextClass(); which used to return Bar class for the
fields that declared in the parent class. But now I don't have that method
in 2.8, but the only option I see is that
annotatedMember.getDeclaringClass() which returns BaseFoo class
Please let me know if more clarification is needed.
Thanks!!
On Tuesday, August 15, 2017 at 5:03:53 PM UTC-7, Tatu Saloranta wrote:
>
> On Tue, Aug 15, 2017 at 4:10 PM, Jama A <[email protected] <javascript:>>
> wrote:
> > I used
> >
> `com.fasterxml.jackson.databind.introspect.AnnotatedMember#getContextClass`
> > in my project to get actual sub-class name that field has a value. But
> it
> > was removed in this commit [Starting work on ensuring proper resolution
> of
> > member types;......]
> > But now I can't find a context class, consider this example.
> >
> > abstract class BaseFoo {
> > private String id;
> > private Long version;
> >
> >
> > /// getters/setters
> >
> >
> > }
> >
> > class Bar extends BaseFoo{
> > //some other fields
> >
> > }
> >
> >
> > In my custom AnnotationIntrospector I need to find the actual sub-class
> > (Bar) from the AnnotatedMember object. I see there's only
> > AnnotatedMember#getDeclaringClass() which returns the class that
> physically
> > declared (BaseFoo)
> >
> > But I can't make use of it - how can I find actual sub-class that
> annotated
> > member field is associated?
>
> Unfortunately I don't think I fully understand the use case from this.
> Could you share example code from your custom AnnotationIntrospector
> method to help understand what information you are looking to get?
>
> -+ 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.