@Override
    public CoinbaseSpotPriceHistory deserialize(JsonParser jp, DeserializationContext ctxt)
        throws IOException, JsonProcessingException {

      final List<CoinbaseHistoricalSpotPrice> historicalPrices =
          new ArrayList<CoinbaseHistoricalSpotPrice>();

      // If there is a better way to get to the actual String returned please replace this section.
      final Reader reader = (Reader) ctxt.getParser().getTokenLocation().getSourceRef();
      reader.reset();
      final StringBuilder historyStringBuilder = new StringBuilder();
      for (int c = reader.read(); c > 0; c = reader.read()) historyStringBuilder.append((char) c);

      // Parse in reverse because they are inconsistent with the number of decimals for the rates
      // which makes it difficult to differentiate from the following year. Going in reverse
      // we can rely on the comma.
      final String entireHistoryString = historyStringBuilder.reverse().toString();
      final Matcher matcher = historicalRateStringPatternInReverse.matcher(entireHistoryString);
      while (matcher.find()) {
        final String rateString = new StringBuilder(matcher.group(1)).reverse().toString();
        final BigDecimal spotRate = new BigDecimal(rateString);
        final String timestampString = new StringBuilder(matcher.group(2)).reverse().toString();
        final Date timestamp = DateUtils.fromISO8601DateString(timestampString);

        final CoinbaseHistoricalSpotPrice historicalSpotPrice =
            new CoinbaseHistoricalSpotPrice(timestamp, spotRate);
        historicalPrices.add(historicalSpotPrice);
      }
      Collections.sort(historicalPrices, Collections.reverseOrder());
      return new CoinbaseSpotPriceHistory(historicalPrices);
    }
 @Override
 public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property)
     throws JsonMappingException {
   // May need to resolve types for delegate-based creators:
   JsonDeserializer<Object> delegate = null;
   if (_valueInstantiator != null) {
     AnnotatedWithParams delegateCreator = _valueInstantiator.getDelegateCreator();
     if (delegateCreator != null) {
       JavaType delegateType = _valueInstantiator.getDelegateType(ctxt.getConfig());
       delegate = findDeserializer(ctxt, delegateType, property);
     }
   }
   JsonDeserializer<?> valueDeser = _valueDeserializer;
   if (valueDeser == null) {
     // #125: May have a content converter
     valueDeser = findConvertingContentDeserializer(ctxt, property, valueDeser);
     if (valueDeser == null) {
       // And we may also need to get deserializer for String
       valueDeser =
           ctxt.findContextualValueDeserializer(_collectionType.getContentType(), property);
     }
   } else { // if directly assigned, probably not yet contextual, so:
     valueDeser = ctxt.handleSecondaryContextualization(valueDeser, property);
   }
   if (isDefaultDeserializer(valueDeser)) {
     valueDeser = null;
   }
   return withResolved(delegate, valueDeser);
 }
 protected final String _locateTypeId(
     JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
     throws IOException {
   if (!paramJsonParser.isExpectedStartArrayToken()) {
     if (this._defaultImpl != null) {
       return this._idResolver.idFromBaseType();
     }
     throw paramDeserializationContext.wrongTokenException(
         paramJsonParser,
         JsonToken.START_ARRAY,
         "need JSON Array to contain As.WRAPPER_ARRAY type information for class "
             + baseTypeName());
   }
   if (paramJsonParser.nextToken() == JsonToken.VALUE_STRING) {
     paramDeserializationContext = paramJsonParser.getText();
     paramJsonParser.nextToken();
     return paramDeserializationContext;
   }
   if (this._defaultImpl != null) {
     return this._idResolver.idFromBaseType();
   }
   throw paramDeserializationContext.wrongTokenException(
       paramJsonParser,
       JsonToken.VALUE_STRING,
       "need JSON String that contains type id (for subtype of " + baseTypeName() + ")");
 }
 @Override
 public Integer deserialize(JsonParser parser, DeserializationContext context)
     throws IOException {
   JsonToken t = parser.getCurrentToken();
   if (t == JsonToken.VALUE_NUMBER_INT
       || t == JsonToken.VALUE_NUMBER_FLOAT) { // coercing should work too
     return rangeCheckedInteger(parser, context);
   }
   if (t == JsonToken.VALUE_STRING) { // let's do implicit re-parse
     String text = parser.getText().trim();
     try {
       int len = text.length();
       if (len > 9) {
         return rangeCheckedInteger(parser, context);
       }
       if (len == 0) {
         return null;
       }
       return Integer.valueOf(NumberInput.parseInt(text));
     } catch (IllegalArgumentException iae) {
       throw context.weirdStringException(_valueClass, "not a valid Integer value"); // NOSONAR
     }
   }
   if (t == JsonToken.VALUE_NULL) {
     return null;
   }
   // Otherwise, no can do:
   throw context.mappingException(_valueClass);
 }
 public String[] deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
 {
   if (!paramJsonParser.isExpectedStartArrayToken())
     return handleNonArray(paramJsonParser, paramDeserializationContext);
   ObjectBuffer localObjectBuffer = paramDeserializationContext.leaseObjectBuffer();
   Object[] arrayOfObject = localObjectBuffer.resetAndStart();
   int i = 0;
   JsonToken localJsonToken = paramJsonParser.nextToken();
   String str;
   if (localJsonToken != JsonToken.END_ARRAY)
     if (localJsonToken == JsonToken.VALUE_NULL)
     {
       str = null;
       label53: if (i < arrayOfObject.length)
         break label122;
       arrayOfObject = localObjectBuffer.appendCompletedChunk(arrayOfObject);
     }
   label122: for (int j = 0; ; j = i)
   {
     i = j + 1;
     arrayOfObject[j] = str;
     break;
     str = _parseString(paramJsonParser, paramDeserializationContext);
     break label53;
     String[] arrayOfString = (String[])localObjectBuffer.completeAndClearBuffer(arrayOfObject, i, String.class);
     paramDeserializationContext.returnObjectBuffer(localObjectBuffer);
     return arrayOfString;
   }
 }
 @Override
 protected Byte _parseByte(JsonParser jp, DeserializationContext ctxt) throws IOException {
   JsonToken t = jp.getCurrentToken();
   Integer value = null;
   if (t == JsonToken.VALUE_NUMBER_INT
       || t == JsonToken.VALUE_NUMBER_FLOAT) { // coercing should work too
     value = jp.getIntValue();
   } else if (t == JsonToken.VALUE_STRING) { // let's do implicit re-parse
     String text = jp.getText().trim();
     try {
       int len = text.length();
       if (len == 0) {
         return getEmptyValue();
       }
       value = NumberInput.parseInt(text);
     } catch (IllegalArgumentException iae) {
       throw ctxt.weirdStringException(_valueClass, "not a valid Byte value"); // NOSONAR
     }
   }
   if (value != null) {
     // So far so good: but does it fit?
     if (value < Byte.MIN_VALUE || value > Byte.MAX_VALUE) {
       throw ctxt.weirdStringException(
           _valueClass, "overflow, value can not be represented as 8-bit value");
     }
     return (byte) (int) value;
   }
   if (t == JsonToken.VALUE_NULL) {
     return getNullValue();
   }
   throw ctxt.mappingException(_valueClass, t);
 }
 /**
  * Contextualization is needed to see whether we can "inline" deserialization of String values, or
  * if we have to use separate value deserializer.
  */
 @Override
 public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property)
     throws JsonMappingException {
   JsonDeserializer<?> deser = _elementDeserializer;
   // May have a content converter
   deser = findConvertingContentDeserializer(ctxt, property, deser);
   JavaType type = ctxt.constructType(String.class);
   if (deser == null) {
     deser = ctxt.findContextualValueDeserializer(type, property);
   } else { // if directly assigned, probably not yet contextual, so:
     deser = ctxt.handleSecondaryContextualization(deser, property, type);
   }
   // One more thing: allow unwrapping?
   Boolean unwrapSingle =
       findFormatFeature(
           ctxt, property, String[].class, JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
   // Ok ok: if all we got is the default String deserializer, can just forget about it
   if ((deser != null) && isDefaultDeserializer(deser)) {
     deser = null;
   }
   if ((_elementDeserializer == deser) && (_unwrapSingle == unwrapSingle)) {
     return this;
   }
   return new StringArrayDeserializer(deser, unwrapSingle);
 }
  @Override
  public LocalDate deserialize(JsonParser parser, DeserializationContext context)
      throws IOException {
    switch (parser.getCurrentToken()) {
      case START_ARRAY:
        if (parser.nextToken() == JsonToken.END_ARRAY) {
          return null;
        }
        int year = parser.getIntValue();

        parser.nextToken();
        int month = parser.getIntValue();

        parser.nextToken();
        int day = parser.getIntValue();

        if (parser.nextToken() != JsonToken.END_ARRAY) {
          throw context.wrongTokenException(parser, JsonToken.END_ARRAY, "Expected array to end.");
        }
        return LocalDate.of(year, month, day);

      case VALUE_STRING:
        String string = parser.getText().trim();
        if (string.length() == 0) {
          return null;
        }
        return LocalDate.parse(string, ISO_DATE_OPTIONAL_TIME);
    }
    throw context.wrongTokenException(parser, JsonToken.START_ARRAY, "Expected array or string.");
  }
 protected Converter<Object, Object> findConverter(DeserializationContext ctxt, Annotated a)
     throws JsonMappingException {
   Object convDef = ctxt.getAnnotationIntrospector().findDeserializationConverter(a);
   if (convDef == null) {
     return null;
   }
   return ctxt.converterInstance(a, convDef);
 }
 @Override
 public ObjectIdResolver newForDeserialization(Object c) {
   DeserializationContext context = (DeserializationContext) c;
   @SuppressWarnings("unchecked")
   Map<Object, WithCustomResolution> pool =
       (Map<Object, WithCustomResolution>) context.getAttribute(POOL_KEY);
   return new PoolResolver(pool);
 }
 /**
  * Helper method called to check if a class or method has annotation that tells which class to use
  * for deserialization. Returns null if no such annotation found.
  */
 protected JsonDeserializer<Object> findDeserializerFromAnnotation(
     DeserializationContext ctxt, Annotated ann) throws JsonMappingException {
   Object deserDef = ctxt.getAnnotationIntrospector().findDeserializer(ann);
   if (deserDef == null) {
     return null;
   }
   JsonDeserializer<Object> deser = ctxt.deserializerInstance(ann, deserDef);
   // One more thing however: may need to also apply a converter:
   return findConvertingDeserializer(ctxt, ann, deser);
 }
 private final boolean[] handleNonArray(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
 {
   if ((paramJsonParser.getCurrentToken() == JsonToken.VALUE_STRING) && (paramDeserializationContext.isEnabled(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT)) && (paramJsonParser.getText().length() == 0))
     return null;
   if (!paramDeserializationContext.isEnabled(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY))
     throw paramDeserializationContext.mappingException(this._valueClass);
   boolean[] arrayOfBoolean = new boolean[1];
   arrayOfBoolean[0] = _parseBooleanPrimitive(paramJsonParser, paramDeserializationContext);
   return arrayOfBoolean;
 }
Exemple #13
0
    protected void addBeanProps(DeserializationContext deserializationcontext, BeanDescription beandescription, BeanDeserializerBuilder beandeserializerbuilder)
        throws JsonMappingException
    {
        SettableBeanProperty asettablebeanproperty[];
        Iterator iterator1;
        boolean flag;
        asettablebeanproperty = beandeserializerbuilder.getValueInstantiator().getFromObjectArguments(deserializationcontext.getConfig());
        Object obj = deserializationcontext.getAnnotationIntrospector();
        Object obj2 = ((AnnotationIntrospector) (obj)).findIgnoreUnknownProperties(beandescription.getClassInfo());
        if (obj2 != null)
        {
            beandeserializerbuilder.setIgnoreUnknownProperties(((Boolean) (obj2)).booleanValue());
        }
        obj = ArrayBuilders.arrayToSet(((AnnotationIntrospector) (obj)).findPropertiesToIgnore(beandescription.getClassInfo()));
        for (obj2 = ((Set) (obj)).iterator(); ((Iterator) (obj2)).hasNext(); beandeserializerbuilder.addIgnorable((String)((Iterator) (obj2)).next())) { }
        obj2 = beandescription.findAnySetter();
        if (obj2 != null)
        {
            beandeserializerbuilder.setAnySetter(constructAnySetter(deserializationcontext, beandescription, ((AnnotatedMethod) (obj2))));
        }
        if (obj2 == null)
        {
            obj2 = beandescription.getIgnoredPropertyNames();
            if (obj2 != null)
            {
                for (obj2 = ((Collection) (obj2)).iterator(); ((Iterator) (obj2)).hasNext(); beandeserializerbuilder.addIgnorable((String)((Iterator) (obj2)).next())) { }
            }
        }
        if (deserializationcontext.isEnabled(MapperFeature.USE_GETTERS_AS_SETTERS) && deserializationcontext.isEnabled(MapperFeature.AUTO_DETECT_GETTERS))
        {
            flag = true;
        } else
        {
            flag = false;
        }
        obj = filterBeanProps(deserializationcontext, beandescription, beandeserializerbuilder, beandescription.findProperties(), ((Set) (obj)));
        obj2 = obj;
        if (_factoryConfig.hasDeserializerModifiers())
        {
            Iterator iterator = _factoryConfig.deserializerModifiers().iterator();
            do
            {
                obj2 = obj;
                if (!iterator.hasNext())
                {
                    break;
                }
                obj = ((BeanDeserializerModifier)iterator.next()).updateProperties(deserializationcontext.getConfig(), beandescription, ((List) (obj)));
            } while (true);
        }
        iterator1 = ((List) (obj2)).iterator();
_L7:
        if (!iterator1.hasNext()) goto _L2; else goto _L1
 @Override
 public JsonDeserializer<Object> createBuilderBasedDeserializer(
     DeserializationContext ctxt,
     JavaType valueType,
     BeanDescription beanDesc,
     Class<?> builderClass)
     throws JsonMappingException {
   // First: need a BeanDescription for builder class
   JavaType builderType = ctxt.constructType(builderClass);
   BeanDescription builderDesc = ctxt.getConfig().introspectForBuilder(builderType);
   return buildBuilderBasedDeserializer(ctxt, valueType, builderDesc);
 }
  @Override
  public EnumMap<?, ?> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
    // Ok: must point to START_OBJECT
    if (jp.getCurrentToken() != JsonToken.START_OBJECT) {
      return _deserializeFromEmpty(jp, ctxt);
    }
    EnumMap result = constructMap();
    final JsonDeserializer<Object> valueDes = _valueDeserializer;
    final TypeDeserializer typeDeser = _valueTypeDeserializer;

    while ((jp.nextToken()) == JsonToken.FIELD_NAME) {
      String keyName = jp.getCurrentName(); // just for error message
      // but we need to let key deserializer handle it separately, nonetheless
      Enum<?> key = (Enum<?>) _keyDeserializer.deserializeKey(keyName, ctxt);
      if (key == null) {
        if (!ctxt.isEnabled(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL)) {
          throw ctxt.weirdStringException(
              keyName,
              _enumClass,
              "value not one of declared Enum instance names for " + _mapType.getKeyType());
        }
        /* 24-Mar-2012, tatu: Null won't work as a key anyway, so let's
         *  just skip the entry then. But we must skip the value as well, if so.
         */
        jp.nextToken();
        jp.skipChildren();
        continue;
      }
      // And then the value...
      JsonToken t = jp.nextToken();
      /* note: MUST check for nulls separately: deserializers will
       * not handle them (and maybe fail or return bogus data)
       */
      Object value;

      try {
        if (t == JsonToken.VALUE_NULL) {
          value = valueDes.getNullValue(ctxt);
        } else if (typeDeser == null) {
          value = valueDes.deserialize(jp, ctxt);
        } else {
          value = valueDes.deserializeWithType(jp, ctxt, typeDeser);
        }
      } catch (Exception e) {
        wrapAndThrow(e, result, keyName);
        return null;
      }
      result.put(key, value);
    }
    return result;
  }
  /** Offlined version used when we do not use the default deserialization method. */
  protected final String[] _deserializeCustom(
      JsonParser p, DeserializationContext ctxt, String[] old) throws IOException {
    final ObjectBuffer buffer = ctxt.leaseObjectBuffer();
    int ix;
    Object[] chunk;

    if (old == null) {
      ix = 0;
      chunk = buffer.resetAndStart();
    } else {
      ix = old.length;
      chunk = buffer.resetAndStart(old, ix);
    }

    final JsonDeserializer<String> deser = _elementDeserializer;

    try {
      while (true) {
        /* 30-Dec-2014, tatu: This may look odd, but let's actually call method
         *   that suggest we are expecting a String; this helps with some formats,
         *   notably XML. Note, however, that while we can get String, we can't
         *   assume that's what we use due to custom deserializer
         */
        String value;
        if (p.nextTextValue() == null) {
          JsonToken t = p.getCurrentToken();
          if (t == JsonToken.END_ARRAY) {
            break;
          }
          // Ok: no need to convert Strings, but must recognize nulls
          value =
              (t == JsonToken.VALUE_NULL) ? deser.getNullValue(ctxt) : deser.deserialize(p, ctxt);
        } else {
          value = deser.deserialize(p, ctxt);
        }
        if (ix >= chunk.length) {
          chunk = buffer.appendCompletedChunk(chunk);
          ix = 0;
        }
        chunk[ix++] = value;
      }
    } catch (Exception e) {
      // note: pass String.class, not String[].class, as we need element type for error info
      throw JsonMappingException.wrapWithPath(e, String.class, ix);
    }
    String[] result = buffer.completeAndClearBuffer(chunk, ix, String.class);
    ctxt.returnObjectBuffer(buffer);
    return result;
  }
 private final byte[] handleNonArray(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
 {
   if ((paramJsonParser.getCurrentToken() == JsonToken.VALUE_STRING) && (paramDeserializationContext.isEnabled(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT)) && (paramJsonParser.getText().length() == 0))
     return null;
   if (!paramDeserializationContext.isEnabled(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY))
     throw paramDeserializationContext.mappingException(this._valueClass);
   JsonToken localJsonToken = paramJsonParser.getCurrentToken();
   if ((localJsonToken == JsonToken.VALUE_NUMBER_INT) || (localJsonToken == JsonToken.VALUE_NUMBER_FLOAT));
   for (int i = paramJsonParser.getByteValue(); ; i = 0)
   {
     return new byte[] { i };
     if (localJsonToken != JsonToken.VALUE_NULL)
       throw paramDeserializationContext.mappingException(this._valueClass.getComponentType());
   }
 }
 public ObjectNode deserialize(JsonParser jsonparser, DeserializationContext deserializationcontext)
 {
     if (jsonparser.getCurrentToken() == JsonToken.START_OBJECT)
     {
         jsonparser.nextToken();
         return deserializeObject(jsonparser, deserializationcontext, deserializationcontext.getNodeFactory());
     }
     if (jsonparser.getCurrentToken() == JsonToken.FIELD_NAME)
     {
         return deserializeObject(jsonparser, deserializationcontext, deserializationcontext.getNodeFactory());
     } else
     {
         throw deserializationcontext.mappingException(com/fasterxml/jackson/databind/node/ObjectNode);
     }
 }
  @Override
  public String[] deserialize(JsonParser p, DeserializationContext ctxt, String[] intoValue)
      throws IOException {
    // Ok: must point to START_ARRAY (or equivalent)
    if (!p.isExpectedStartArrayToken()) {
      String[] arr = handleNonArray(p, ctxt);
      if (arr == null) {
        return intoValue;
      }
      final int offset = intoValue.length;
      String[] result = new String[offset + arr.length];
      System.arraycopy(intoValue, 0, result, 0, offset);
      System.arraycopy(arr, 0, result, offset, arr.length);
      return result;
    }

    if (_elementDeserializer != null) {
      return _deserializeCustom(p, ctxt, intoValue);
    }
    final ObjectBuffer buffer = ctxt.leaseObjectBuffer();
    int ix = intoValue.length;
    Object[] chunk = buffer.resetAndStart(intoValue, ix);

    try {
      while (true) {
        String value = p.nextTextValue();
        if (value == null) {
          JsonToken t = p.getCurrentToken();
          if (t == JsonToken.END_ARRAY) {
            break;
          }
          if (t != JsonToken.VALUE_NULL) {
            value = _parseString(p, ctxt);
          }
        }
        if (ix >= chunk.length) {
          chunk = buffer.appendCompletedChunk(chunk);
          ix = 0;
        }
        chunk[ix++] = value;
      }
    } catch (Exception e) {
      throw JsonMappingException.wrapWithPath(e, chunk, buffer.bufferedSize() + ix);
    }
    String[] result = buffer.completeAndClearBuffer(chunk, ix, String.class);
    ctxt.returnObjectBuffer(buffer);
    return result;
  }
 @Override
 public JSONObject deserialize(JsonParser jp, DeserializationContext ctxt)
     throws IOException, JsonProcessingException {
   JSONObject ob = new JSONObject();
   JsonToken t = jp.getCurrentToken();
   if (t == JsonToken.START_OBJECT) {
     t = jp.nextToken();
   }
   for (; t == JsonToken.FIELD_NAME; t = jp.nextToken()) {
     String fieldName = jp.getCurrentName();
     t = jp.nextToken();
     try {
       switch (t) {
         case START_ARRAY:
           ob.put(fieldName, JSONArrayDeserializer.instance.deserialize(jp, ctxt));
           continue;
         case START_OBJECT:
           ob.put(fieldName, deserialize(jp, ctxt));
           continue;
         case VALUE_STRING:
           ob.put(fieldName, jp.getText());
           continue;
         case VALUE_NULL:
           ob.put(fieldName, JSONObject.NULL);
           continue;
         case VALUE_TRUE:
           ob.put(fieldName, Boolean.TRUE);
           continue;
         case VALUE_FALSE:
           ob.put(fieldName, Boolean.FALSE);
           continue;
         case VALUE_NUMBER_INT:
           ob.put(fieldName, jp.getNumberValue());
           continue;
         case VALUE_NUMBER_FLOAT:
           ob.put(fieldName, jp.getNumberValue());
           continue;
         case VALUE_EMBEDDED_OBJECT:
           ob.put(fieldName, jp.getEmbeddedObject());
           continue;
       }
     } catch (JSONException e) {
       throw ctxt.mappingException("Failed to construct JSONObject: " + e.getMessage());
     }
     throw ctxt.mappingException("Urecognized or unsupported JsonToken type: " + t);
   }
   return ob;
 }
  /**
   * Method called to construct fallback {@link SettableAnyProperty} for handling unknown bean
   * properties, given a method that has been designated as such setter.
   */
  protected SettableAnyProperty constructAnySetter(
      DeserializationContext ctxt, BeanDescription beanDesc, AnnotatedMethod setter)
      throws JsonMappingException {
    if (ctxt.canOverrideAccessModifiers()) {
      setter.fixAccess(); // to ensure we can call it
    }
    // we know it's a 2-arg method, second arg is the value
    JavaType type = beanDesc.bindingsForBeanType().resolveType(setter.getGenericParameterType(1));
    BeanProperty.Std property =
        new BeanProperty.Std(setter.getName(), type, beanDesc.getClassAnnotations(), setter);
    type = resolveType(ctxt, beanDesc, type, setter);

    /* AnySetter can be annotated with @JsonClass (etc) just like a
     * regular setter... so let's see if those are used.
     * Returns null if no annotations, in which case binding will
     * be done at a later point.
     */
    JsonDeserializer<Object> deser = findDeserializerFromAnnotation(ctxt, setter);
    if (deser != null) {
      return new SettableAnyProperty(property, setter, type, deser);
    }
    /* Otherwise, method may specify more specific (sub-)class for
     * value (no need to check if explicit deser was specified):
     */
    type = modifyTypeByAnnotation(ctxt, setter, type);
    return new SettableAnyProperty(property, setter, type, null);
  }
 public static PropertyBasedCreator construct(
     DeserializationContext ctxt,
     ValueInstantiator valueInstantiator,
     SettableBeanProperty[] srcProps)
     throws JsonMappingException {
   int len = srcProps.length;
   SettableBeanProperty[] creatorProps = new SettableBeanProperty[len];
   Object[] defaultValues = null;
   for (int i = 0; i < len; i++) {
     SettableBeanProperty prop = srcProps[i];
     if (!prop.hasValueDeserializer()) {
       prop =
           prop.withValueDeserializer(ctxt.findContextualValueDeserializer(prop.getType(), prop));
     }
     creatorProps[i] = prop;
     JsonDeserializer<?> deser = prop.getValueDeserializer();
     Object nullValue = deser == null ? null : deser.getNullValue();
     if (nullValue == null && prop.getType().isPrimitive()) {
       nullValue = ClassUtil.defaultValue(prop.getType().getRawClass());
     }
     if (nullValue != null) {
       if (defaultValues == null) {
         defaultValues = new Object[len];
       }
       defaultValues[i] = nullValue;
     }
   }
   return new PropertyBasedCreator(valueInstantiator, creatorProps, defaultValues);
 }
 public float[] deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
 {
   if (!paramJsonParser.isExpectedStartArrayToken())
     return handleNonArray(paramJsonParser, paramDeserializationContext);
   ArrayBuilders.FloatBuilder localFloatBuilder = paramDeserializationContext.getArrayBuilders().getFloatBuilder();
   Object localObject = (float[])localFloatBuilder.resetAndStart();
   int i = 0;
   float f;
   int j;
   if (paramJsonParser.nextToken() != JsonToken.END_ARRAY)
   {
     f = _parseFloatPrimitive(paramJsonParser, paramDeserializationContext);
     if (i < localObject.length)
       break label108;
     float[] arrayOfFloat = (float[])localFloatBuilder.appendCompletedChunk(localObject, i);
     j = 0;
     localObject = arrayOfFloat;
   }
   while (true)
   {
     i = j + 1;
     localObject[j] = f;
     break;
     return (float[])localFloatBuilder.completeAndClearBuffer(localObject, i);
     label108: j = i;
   }
 }
  @Override
  public T deserialize(final JsonParser jp, final DeserializationContext ctxt)
      throws IOException, JsonProcessingException {

    client = (ODataClient) ctxt.findInjectableValue(ODataClient.class.getName(), null, null);
    return doDeserialize(jp, ctxt);
  }
 public short[] deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
 {
   if (!paramJsonParser.isExpectedStartArrayToken())
     return handleNonArray(paramJsonParser, paramDeserializationContext);
   ArrayBuilders.ShortBuilder localShortBuilder = paramDeserializationContext.getArrayBuilders().getShortBuilder();
   Object localObject = (short[])localShortBuilder.resetAndStart();
   int i = 0;
   int j;
   int k;
   if (paramJsonParser.nextToken() != JsonToken.END_ARRAY)
   {
     j = _parseShortPrimitive(paramJsonParser, paramDeserializationContext);
     if (i < localObject.length)
       break label108;
     short[] arrayOfShort = (short[])localShortBuilder.appendCompletedChunk(localObject, i);
     k = 0;
     localObject = arrayOfShort;
   }
   while (true)
   {
     i = k + 1;
     localObject[k] = j;
     break;
     return (short[])localShortBuilder.completeAndClearBuffer(localObject, i);
     label108: k = i;
   }
 }
 public boolean[] deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
 {
   if (!paramJsonParser.isExpectedStartArrayToken())
     return handleNonArray(paramJsonParser, paramDeserializationContext);
   ArrayBuilders.BooleanBuilder localBooleanBuilder = paramDeserializationContext.getArrayBuilders().getBooleanBuilder();
   Object localObject = (boolean[])localBooleanBuilder.resetAndStart();
   int i = 0;
   boolean bool;
   int j;
   if (paramJsonParser.nextToken() != JsonToken.END_ARRAY)
   {
     bool = _parseBooleanPrimitive(paramJsonParser, paramDeserializationContext);
     if (i < localObject.length)
       break label108;
     boolean[] arrayOfBoolean = (boolean[])localBooleanBuilder.appendCompletedChunk(localObject, i);
     j = 0;
     localObject = arrayOfBoolean;
   }
   while (true)
   {
     i = j + 1;
     localObject[j] = bool;
     break;
     return (boolean[])localBooleanBuilder.completeAndClearBuffer(localObject, i);
     label108: j = i;
   }
 }
  /*
   * (non-Javadoc)
   *
   * @see
   * org.codehaus.jackson.map.JsonDeserializer#deserialize(org.codehaus.jackson
   * .JsonParser, org.codehaus.jackson.map.DeserializationContext)
   */
  @Override
  public NamedErlangFunction deserialize(JsonParser jp, DeserializationContext ctxt)
      throws IOException, JsonProcessingException {

    JsonToken token = jp.getCurrentToken();

    if (JsonToken.START_OBJECT.equals(token)) {

      String mod = null;
      String fun = null;

      while (!JsonToken.END_OBJECT.equals(token)) {
        String field = jp.getCurrentName();

        if (Constants.FL_SCHEMA_FUN_MOD.equals(field)) {
          jp.nextToken();
          mod = jp.getText();
        } else if (Constants.FL_SCHEMA_FUN_FUN.equals(field)) {
          jp.nextToken();
          fun = jp.getText();
        }
        token = jp.nextToken();
      }
      if (mod != null && fun != null) {
        return new NamedErlangFunction(mod, fun);
      } else {
        return null;
      }
    }
    throw ctxt.mappingException(NamedErlangFunction.class);
  }
  /** Method that will construct a regular bean property setter using the given setter method. */
  protected SettableBeanProperty constructSetterlessProperty(
      DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef)
      throws JsonMappingException {
    final AnnotatedMethod getter = propDef.getGetter();
    // need to ensure it is callable now:
    if (ctxt.canOverrideAccessModifiers()) {
      getter.fixAccess();
    }

    /* 26-Jan-2012, tatu: Alas, this complication is still needed to handle
     *   (or at least work around) local type declarations...
     */
    JavaType type = getter.getType(beanDesc.bindingsForBeanType());
    /* First: does the Method specify the deserializer to use?
     * If so, let's use it.
     */
    JsonDeserializer<Object> propDeser = findDeserializerFromAnnotation(ctxt, getter);
    type = modifyTypeByAnnotation(ctxt, getter, type);
    TypeDeserializer typeDeser = type.getTypeHandler();
    SettableBeanProperty prop =
        new SetterlessProperty(propDef, type, typeDeser, beanDesc.getClassAnnotations(), getter);
    if (propDeser != null) {
      prop = prop.withValueDeserializer(propDeser);
    }
    return prop;
  }
 protected T _deserializeEmbedded(
     Object paramObject, DeserializationContext paramDeserializationContext) throws IOException {
   throw paramDeserializationContext.mappingException(
       "Don't know how to convert embedded Object of type "
           + paramObject.getClass().getName()
           + " into "
           + this._valueClass.getName());
 }
 public JsonDeserializer<?> createContextual(
     DeserializationContext deserializationContext, BeanProperty beanProperty) {
   if (this._delegateDeserializer != null) {
     JsonDeserializer handleSecondaryContextualization =
         deserializationContext.handleSecondaryContextualization(
             this._delegateDeserializer, beanProperty);
     if (handleSecondaryContextualization != this._delegateDeserializer) {
       return withDelegate(this._converter, this._delegateType, handleSecondaryContextualization);
     }
     return this;
   }
   JavaType inputType = this._converter.getInputType(deserializationContext.getTypeFactory());
   return withDelegate(
       this._converter,
       inputType,
       deserializationContext.findContextualValueDeserializer(inputType, beanProperty));
 }