com.fasterxml.jackson.databind.KeyDeserializer Java Examples

The following examples show how to use com.fasterxml.jackson.databind.KeyDeserializer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HashMultimapDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
@Override
protected JsonDeserializer<?> _createContextual(JavaType type,
        KeyDeserializer keyDeserializer, TypeDeserializer typeDeserializer,
        JsonDeserializer<?> elementDeserializer, Method method, NullValueProvider nvp) {
    return new HashMultimapDeserializer(type, keyDeserializer, typeDeserializer,
            elementDeserializer, method, nvp);
}
 
Example #2
Source File: RefStdKeyDeserializer.java    From gwt-jackson with Apache License 2.0 5 votes vote down vote up
@Override
public KeyDeserializer createContextual( DeserializationContext ctxt, BeanProperty property ) throws JsonMappingException {
    if ( ctxt.getContextualType() == null || ctxt.getContextualType().containedType( 0 ) == null || ctxt.getContextualType().containedType( 0 ).containedType( 0 ) == null ) {
        throw JsonMappingException.from( ctxt, "Cannot deserialize Ref<T>. Cannot find the Generic Type T." );
    }
    return new RefStdKeyDeserializer( ctxt.getContextualType().containedType( 0 ).containedType( 0 ) );
}
 
Example #3
Source File: Issue142Test.java    From vavr-jackson with Apache License 2.0 5 votes vote down vote up
@BeforeEach
public void before() {
    mapper = new ObjectMapper();
    SimpleModule module = new VavrModule()
            .addKeyDeserializer(MyComparable.class, new KeyDeserializer() {
                @Override
                public Object deserializeKey(String key, DeserializationContext ctxt) {
                    return new MyComparable(Integer.parseInt(key));
                }
            });
    mapper.registerModule(module);
}
 
Example #4
Source File: SourceMapDeserializer.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
private SourceMapDeserializer(final MapDeserializer src,
                             final KeyDeserializer keyDeser,
                             final JsonDeserializer<Object> valueDeser,
                             final TypeDeserializer valueTypeDeser,
                             final NullValueProvider nuller,
                             final Set<String> ignorable)
{
  super(src, keyDeser, valueDeser, valueTypeDeser, nuller, ignorable);
}
 
Example #5
Source File: ConvertingDeserializers.java    From graphql-spqr with Apache License 2.0 5 votes vote down vote up
@Override
public JsonDeserializer<?> findMapDeserializer(MapType type, DeserializationConfig config,
                                               BeanDescription beanDesc, KeyDeserializer keyDeserializer,
                                               TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) {

    return forJavaType(type);
}
 
Example #6
Source File: ImmutableMapDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
@Override
public ImmutableMapDeserializer withResolved(KeyDeserializer keyDeser,
        JsonDeserializer<?> valueDeser, TypeDeserializer valueTypeDeser,
        NullValueProvider nuller) {
    return new ImmutableMapDeserializer(_containerType, keyDeser,
            valueDeser, valueTypeDeser, nuller);
}
 
Example #7
Source File: ArrayListMultimapDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
@Override
protected JsonDeserializer<?> _createContextual(JavaType type,
        KeyDeserializer keyDeserializer, TypeDeserializer typeDeserializer,
        JsonDeserializer<?> elementDeserializer, Method method,
        NullValueProvider nvp) {
    return new ArrayListMultimapDeserializer(type, keyDeserializer, typeDeserializer,
            elementDeserializer, method, nvp);
}
 
Example #8
Source File: LinkedListMultimapDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
@Override
protected JsonDeserializer<?> _createContextual(JavaType type,
        KeyDeserializer keyDeserializer, TypeDeserializer typeDeserializer,
        JsonDeserializer<?> elementDeserializer, Method method, NullValueProvider nvp) {
    return new LinkedListMultimapDeserializer(type, keyDeserializer, typeDeserializer,
            elementDeserializer, method, nvp);
}
 
Example #9
Source File: LinkedHashMultimapDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
@Override
protected JsonDeserializer<?> _createContextual(JavaType type,
        KeyDeserializer keyDeserializer, TypeDeserializer typeDeserializer,
        JsonDeserializer<?> elementDeserializer, Method method, NullValueProvider nvp)
{
    return new LinkedHashMultimapDeserializer(type, keyDeserializer, typeDeserializer,
            elementDeserializer, method, nvp);
}
 
Example #10
Source File: ImmutableSortedMapDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
@Override
public GuavaMapDeserializer<ImmutableSortedMap<Object, Object>> withResolved(KeyDeserializer keyDeser,
        JsonDeserializer<?> valueDeser, TypeDeserializer typeDeser,
        NullValueProvider nuller)
{
    return new ImmutableSortedMapDeserializer(_containerType, keyDeser, valueDeser, typeDeser, nuller);
}
 
Example #11
Source File: JacksonHandlerInstantiatorTest.java    From log4j2-elasticsearch with Apache License 2.0 5 votes vote down vote up
@Test
public void keyDeserializerInstanceReturnsNull() {

    // given
    VirtualProperty[] customProperties = new VirtualProperty[0];
    Log4j2Lookup valueResolver = new Log4j2Lookup(null);
    JacksonHandlerInstantiator handlerInstantiator = createTestHandlerInstantiator(customProperties, valueResolver);

    // when
    KeyDeserializer result = handlerInstantiator.keyDeserializerInstance(null, null, null);

    // then
    Assert.assertNull(result);

}
 
Example #12
Source File: CompositeDeserializers.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
@Override
public JsonDeserializer<?> findMapLikeDeserializer(MapLikeType type, DeserializationConfig config, BeanDescription beanDesc,
                                                   KeyDeserializer keyDeserializer, TypeDeserializer elementTypeDeserializer,
                                                   JsonDeserializer<?> elementDeserializer) throws JsonMappingException {
    for (Deserializers deserializers : deserializersList) {
        JsonDeserializer<?> deserializer = deserializers.findMapLikeDeserializer(type, config, beanDesc, keyDeserializer, elementTypeDeserializer, elementDeserializer);
        if (deserializer != null) {
            return deserializer;
        }
    }
    return null;
}
 
Example #13
Source File: RefKeyHandler.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
public RefKeyHandler(JavaType keyType, KeyDeserializer _keyDeserializer) {
    if (keyType == null) {
        throw new IllegalArgumentException("keyType == null");
    }

    this._keyType = keyType;
    this._keyDeserializer = _keyDeserializer;
}
 
Example #14
Source File: CompositeDeserializers.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
@Override
public JsonDeserializer<?> findMapDeserializer(MapType type, DeserializationConfig config, BeanDescription beanDesc,
                                               KeyDeserializer keyDeserializer, TypeDeserializer elementTypeDeserializer,
                                               JsonDeserializer<?> elementDeserializer) throws JsonMappingException {
    for (Deserializers deserializers : deserializersList) {
        JsonDeserializer<?> deserializer = deserializers.findMapDeserializer(type, config, beanDesc, keyDeserializer, elementTypeDeserializer, elementDeserializer);
        if (deserializer != null) {
            return deserializer;
        }
    }
    return null;
}
 
Example #15
Source File: MapDeserializer.java    From vavr-jackson with Apache License 2.0 4 votes vote down vote up
MapDeserializer(MapDeserializer origin, KeyDeserializer keyDeserializer, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> valueDeserializer) {
    super(origin.mapType, keyDeserializer, elementTypeDeserializer, valueDeserializer);
}
 
Example #16
Source File: MapDeserializer.java    From vavr-jackson with Apache License 2.0 4 votes vote down vote up
MapDeserializer(MapLikeType mapType, KeyDeserializer keyDeserializer, TypeDeserializer elementTypeDeserializer,
                JsonDeserializer<?> elementDeserializer) {
    super(mapType, keyDeserializer, elementTypeDeserializer, elementDeserializer);
}
 
Example #17
Source File: SpringHandlerInstantiator.java    From cloud-config with MIT License 4 votes vote down vote up
@Override
public KeyDeserializer keyDeserializerInstance(DeserializationConfig config,
                                               Annotated annotated, Class<?> serClass) {
    return (KeyDeserializer) this.beanFactory.createBean(serClass);
}
 
Example #18
Source File: ResolverInstantiator.java    From requery with Apache License 2.0 4 votes vote down vote up
@Override
public KeyDeserializer keyDeserializerInstance(DeserializationConfig config, Annotated annotated, Class<?> keyDeserClass) {
    return null;
}
 
Example #19
Source File: AssignableFromDeserializers.java    From titus-control-plane with Apache License 2.0 4 votes vote down vote up
@Override
public JsonDeserializer<?> findMapDeserializer(MapType type, DeserializationConfig config, BeanDescription beanDesc, KeyDeserializer keyDeserializer,
                                               TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer)
        throws JsonMappingException {
    return getDeserializer(type.getRawClass());
}
 
Example #20
Source File: ArrayListMultimapDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 4 votes vote down vote up
public ArrayListMultimapDeserializer(JavaType type, KeyDeserializer keyDeserializer,
        TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer,
        Method creatorMethod, NullValueProvider nvp) {
    super(type, keyDeserializer, elementTypeDeserializer, elementDeserializer, creatorMethod, nvp);
}
 
Example #21
Source File: RestOperationsFactory.java    From bowman with Apache License 2.0 4 votes vote down vote up
@Override
public KeyDeserializer keyDeserializerInstance(DeserializationConfig config, Annotated annotated,
		Class<?> keyDeserClass) {
	return (KeyDeserializer) findHandlerInstance(keyDeserClass);
}
 
Example #22
Source File: ConvertingDeserializers.java    From graphql-spqr with Apache License 2.0 4 votes vote down vote up
@Override
public JsonDeserializer<?> findMapLikeDeserializer(MapLikeType type, DeserializationConfig config, BeanDescription beanDesc, KeyDeserializer keyDeserializer, TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) {
    return forJavaType(type);
}
 
Example #23
Source File: AssignableFromDeserializers.java    From titus-control-plane with Apache License 2.0 4 votes vote down vote up
@Override
public JsonDeserializer<?> findMapLikeDeserializer(MapLikeType type, DeserializationConfig config, BeanDescription beanDesc,
                                                   KeyDeserializer keyDeserializer, TypeDeserializer elementTypeDeserializer,
                                                   JsonDeserializer<?> elementDeserializer) throws JsonMappingException {
    return getDeserializer(type.getRawClass());
}
 
Example #24
Source File: HashTreePMapDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 4 votes vote down vote up
@Override
public HashTreePMapDeserializer withResolved(KeyDeserializer keyDeser,
        TypeDeserializer typeDeser, JsonDeserializer<?> valueDeser) {
    return new HashTreePMapDeserializer(_mapType, keyDeser,
            typeDeser, valueDeser);
}
 
Example #25
Source File: HashTreePMapDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 4 votes vote down vote up
public HashTreePMapDeserializer(MapType type, KeyDeserializer keyDeser,
        TypeDeserializer typeDeser, JsonDeserializer<?> deser)
{
    super(type, keyDeser, typeDeser, deser);
}
 
Example #26
Source File: MapDeserializer.java    From vavr-jackson with Apache License 2.0 4 votes vote down vote up
@Override
MaplikeDeserializer<Map<?, ?>> createDeserializer(KeyDeserializer keyDeserializer,
                                                  TypeDeserializer elementTypeDeserializer,
                                                  JsonDeserializer<?> valueDeserializer) {
    return new MapDeserializer(this, keyDeserializer, elementTypeDeserializer, valueDeserializer);
}
 
Example #27
Source File: ImmutableMapDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 4 votes vote down vote up
public ImmutableMapDeserializer(JavaType type, KeyDeserializer keyDeser,
        JsonDeserializer<?> valueDeser, TypeDeserializer valueTypeDeser,
        NullValueProvider nuller)
{
    super(type, keyDeser, valueDeser, valueTypeDeser, nuller);
}
 
Example #28
Source File: SpringHandlerInstantiator.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public KeyDeserializer keyDeserializerInstance(DeserializationConfig config, Annotated annotated, Class<?> implClass) {
	return (KeyDeserializer) this.beanFactory.createBean(implClass);
}
 
Example #29
Source File: SpringHandlerInstantiator.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public KeyDeserializer keyDeserializerInstance(DeserializationConfig config,
		Annotated annotated, Class<?> implClass) {

	return (KeyDeserializer) this.beanFactory.createBean(implClass);
}
 
Example #30
Source File: ArrayListMultimapDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 4 votes vote down vote up
public ArrayListMultimapDeserializer(JavaType type, KeyDeserializer keyDeserializer,
        TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) {
    super(type, keyDeserializer, elementTypeDeserializer, elementDeserializer);
}