(previous messages deleted because they were not complete)

@Tatu:
I am creating a PropertyNamingStrategy.
I need the AnnotatedField because it is a dependency of a 
PropertyNamingStrategy.
So, something like this:

private String jsonName(JsonProperty jsonProp, Field field, AnnotationMap 
annMap ) {
   
   PropertyNamingStrategy strategy = getNamingStrategy(); // 
getNamingStrategy is my personal method


   if (strategy != null) {
      MapperConfig<?> config = mapper.getSerializationConfig();
      TypeResolutionContext typeResolutionContext = ...;     // where do I 
get this/ class that implements the TypeResolutionContext interface??
      AnnotatedField annotatedField = new AnnotatedField( 
typeResolutionContext, field, annMap);


      return strategy.nameForField(config, annotatedField, field.getName()); 
   } else {
       return field.getName();
   }
}


So you are saying that the class that has the  AnnotatedField method is not 
supposed to be accessed outside of jackson? 
Then shouldn't that class be package protected/ protected? Or have a 
"warning" in the javadoc saying it is an "internal" class that should be 
only used by jackson?

So, how can I circumvent that then?

Thanks!

On Wednesday, August 10, 2016 at 1:36:53 AM UTC+2, Tatu Saloranta wrote:
>
> On Tue, Aug 9, 2016 at 3:03 AM, JonyD <[email protected] <javascript:>> 
> wrote:
>
>> Hi, 
>> I will repost the question I did in stackoverflow (
>> http://stackoverflow.com/questions/38797189/how-to-access-typeresolutioncontext-in-jackson-2-8-1
>> ).
>>
>>
>> I am upgrading jackson library in a java project from version 2.4.6 to 
>> the latest version (2.8.1). The following AnnotatedField method requires 
>> now a new parameter of type TypeResolutionContext
>>
>> // v2.4.6AnnotatedField(Field field, AnnotationMap annMap)
>> // v2.8.1AnnotatedField(TypeResolutionContext contextClass, Field field, 
>> AnnotationMap annMap)
>>
>> I read the API (
>> https://fasterxml.github.io/jackson-databind/javadoc/2.8/com/fasterxml/jackson/databind/introspect/TypeResolutionContext.html)
>>  
>> but can't find how to get this TypeResolutionContext.
>>
>> Only 2 classes implement this TypeResolutionContext (AnnotatedClass and 
>> TypeResolutionContext.Basic) but none of them seem to have suitable 
>> accessor methods that return a TypeResolutionContext.
>>
>>
>> Anyone knows how can I get it?
>>
>
> This class is not intended to be instantiate by code outside of Jackson 
> itself, so there should be no need to pass that. It is something Jackson 
> would provide.
>
> So I think the question is rather if there is a way to do whatever you are 
> trying to achieve without trying to construct an AnnotatedField instance.
>
> -+ 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