Re: [jackson-user] Replacing a custom resolver with @JsonSubTypes

2016-10-14 Thread Benson Margulies
Never mind, I'd made a dumb error. It's working with defaultImpl.


On Fri, Oct 14, 2016 at 11:44 AM, Benson Margulies  wrote:
> I just tried that, and didn't get any change in the behavior. The code
> is on github but it's not a small test case. I fear that the issue
> here is that I'm working with Map values, not just an ordinary field.
>
>
> On Fri, Oct 14, 2016 at 11:39 AM, Tatu Saloranta  wrote:
>> The only thing is @JsonTypeInfo(defaultImpl=...) which would be used if
>> nothing is found or matches.
>>
>> -+ Tatu +-
>>
>>
>> On Fri, Oct 14, 2016 at 8:01 AM, Benson Margulies 
>> wrote:
>>>
>>> Note the fallback if statement here. Is there a way to do an @Type
>>> that says what to do if nothing else matches?
>>>
>>> @Override
>>> public JavaType typeFromId(DatabindContext context, String id) {
>>> KnownAttribute attribute = KnownAttribute.getAttributeForKey(id);
>>> if (attribute == null) {
>>> attribute = KnownAttribute.UNKNOWN; // extension mechanism,
>>> build a BaseAttribute.
>>> }
>>> return context.constructType(attribute.attributeClass());
>>> }
>>>
>>> --
>>> 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 jackson-user+unsubscr...@googlegroups.com.
>>> To post to this group, send email to jackson-user@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
>> 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 jackson-user+unsubscr...@googlegroups.com.
>> To post to this group, send email to jackson-user@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.

-- 
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 jackson-user+unsubscr...@googlegroups.com.
To post to this group, send email to jackson-user@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jackson-user] Replacing a custom resolver with @JsonSubTypes

2016-10-14 Thread Tatu Saloranta
The only thing is @JsonTypeInfo(defaultImpl=...) which would be used if
nothing is found or matches.

-+ Tatu +-


On Fri, Oct 14, 2016 at 8:01 AM, Benson Margulies 
wrote:

> Note the fallback if statement here. Is there a way to do an @Type
> that says what to do if nothing else matches?
>
> @Override
> public JavaType typeFromId(DatabindContext context, String id) {
> KnownAttribute attribute = KnownAttribute.getAttributeForKey(id);
> if (attribute == null) {
> attribute = KnownAttribute.UNKNOWN; // extension mechanism,
> build a BaseAttribute.
> }
> return context.constructType(attribute.attributeClass());
> }
>
> --
> 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 jackson-user+unsubscr...@googlegroups.com.
> To post to this group, send email to jackson-user@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 jackson-user+unsubscr...@googlegroups.com.
To post to this group, send email to jackson-user@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[jackson-user] Replacing a custom resolver with @JsonSubTypes

2016-10-14 Thread Benson Margulies
Note the fallback if statement here. Is there a way to do an @Type
that says what to do if nothing else matches?

@Override
public JavaType typeFromId(DatabindContext context, String id) {
KnownAttribute attribute = KnownAttribute.getAttributeForKey(id);
if (attribute == null) {
attribute = KnownAttribute.UNKNOWN; // extension mechanism,
build a BaseAttribute.
}
return context.constructType(attribute.attributeClass());
}

-- 
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 jackson-user+unsubscr...@googlegroups.com.
To post to this group, send email to jackson-user@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.