Package org.codehaus.jackson.map

Examples of org.codehaus.jackson.map.KeyDeserializer


        // Ok: must point to START_OBJECT
        if (jp.getCurrentToken() != JsonToken.START_OBJECT) {
            throw ctxt.mappingException(_mapClass);
        }

        KeyDeserializer keyDes = _keyDeserializer;
        JsonDeserializer<Object> valueDes = _valueDeserializer;

        while ((jp.nextToken()) != JsonToken.END_OBJECT) {
            // Must point to field name
            String fieldName = jp.getCurrentName();
            Object key = (keyDes == null) ? fieldName : keyDes.deserializeKey(fieldName, ctxt);
            // And then the value...
            JsonToken t = jp.nextToken();
            // Note: must handle null explicitly here; value deserializers won't
            Object value = (t == JsonToken.VALUE_NULL) ? null : valueDes.deserialize(jp, ctxt);
            /* !!! 23-Dec-2008, tatu: should there be an option to verify
View Full Code Here


   
    @Override
    protected ImmutableMap<Object, Object> _deserializeEntries(JsonParser jp,
            DeserializationContext ctxt) throws IOException, JsonProcessingException
    {
        final KeyDeserializer keyDes = _keyDeserializer;
        final JsonDeserializer<?> valueDes = _valueDeserializer;
        final TypeDeserializer typeDeser = _typeDeserializerForValue;

        ImmutableMap.Builder<Object,Object> builder = ImmutableMap.builder();
        for (; jp.getCurrentToken() == JsonToken.FIELD_NAME; jp.nextToken()) {
            // Must point to field name now
            String fieldName = jp.getCurrentName();
            Object key = (keyDes == null) ? fieldName : keyDes.deserializeKey(fieldName, ctxt);
            // And then the value...
            JsonToken t = jp.nextToken();
            // 28-Nov-2010, tatu: Should probably support "ignorable properties" in future...
            Object value;           
            if (t == JsonToken.VALUE_NULL) {
View Full Code Here

    if (type.getRawClass() == Array.class) {
      return new JSArrayDeserializer(type, provider.findValueDeserializer(config,
          ((SimpleType) type).containedType(0), property), null);
    }
    if (type.getRawClass() == Map.class) {
      KeyDeserializer keyDeserializer = provider.findKeyDeserializer(config,
          ((SimpleType) type).containedType(0), property);
      return new JSMapDeserializer(type, keyDeserializer, provider.findValueDeserializer(config,
          ((SimpleType) type).containedType(1), property), null);
    }
    return super.findBeanDeserializer(type, config, provider, beanDesc, property);
View Full Code Here

      JsonProcessingException {
    JsonToken t = jp.getCurrentToken();
    if (t == JsonToken.START_OBJECT) {
      t = jp.nextToken();
    }
    final KeyDeserializer keyDes = _keyDeserializer;
    final JsonDeserializer<Object> valueDes = _valueDeserializer;
    final TypeDeserializer typeDeser = _valueTypeDeserializer;
    for (; t == JsonToken.FIELD_NAME; t = jp.nextToken()) {
      // Must point to field name
      String fieldName = jp.getCurrentName();
      Object key = (keyDes == null) ? fieldName : keyDes.deserializeKey(fieldName, ctxt);
      // And then the value...
      t = jp.nextToken();

      // Note: must handle null explicitly here; value deserializers won't
      Object value;
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.map.KeyDeserializer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.