public static JsonDeserializer<?> forType(Class<?> rawType) { // Start with more common types... if (rawType == Integer.TYPE) { return IntDeser.instance; } if (rawType == Long.TYPE) { return LongDeser.instance; } if (rawType == Byte.TYPE) { return new ByteDeser(); } if (rawType == Short.TYPE) { return new ShortDeser(); } if (rawType == Float.TYPE) { return new FloatDeser(); } if (rawType == Double.TYPE) { return new DoubleDeser(); } if (rawType == Boolean.TYPE) { return new BooleanDeser(); } if (rawType == Character.TYPE) { return new CharDeser(); } throw new IllegalStateException(); }
return handleNonArray(p, ctxt); continue; _verifyNullForPrimitive(ctxt); value = (byte) 0; } else { value = _parseBytePrimitive(p, ctxt);
@Override protected byte[] handleSingleElementUnwrapped(JsonParser p, DeserializationContext ctxt) throws IOException { byte value; JsonToken t = p.getCurrentToken(); if (t == JsonToken.VALUE_NUMBER_INT || t == JsonToken.VALUE_NUMBER_FLOAT) { // should we catch overflow exceptions? value = p.getByteValue(); } else { // should probably accept nulls as 'false' if (t == JsonToken.VALUE_NULL) { if (_nuller != null) { _nuller.getNullValue(ctxt); return (byte[]) getEmptyValue(ctxt); } _verifyNullForPrimitive(ctxt); return null; } Number n = (Number) ctxt.handleUnexpectedToken(_valueClass.getComponentType(), p); value = n.byteValue(); } return new byte[] { value }; }
return handleNonArray(p, ctxt); continue; _verifyNullForPrimitive(ctxt); value = (byte) 0; } else { value = _parseBytePrimitive(p, ctxt);
return handleNonArray(p, ctxt);
return handleNonArray(jp, ctxt);
return handleNonArray(jp, ctxt);
return handleNonArray(jp, ctxt);
return handleNonArray(jp, ctxt);
public static JsonDeserializer<?> forType(Class<?> rawType) { // Start with more common types... if (rawType == Integer.TYPE) { return IntDeser.instance; } if (rawType == Long.TYPE) { return LongDeser.instance; } if (rawType == Byte.TYPE) { return new ByteDeser(); } if (rawType == Short.TYPE) { return new ShortDeser(); } if (rawType == Float.TYPE) { return new FloatDeser(); } if (rawType == Double.TYPE) { return new DoubleDeser(); } if (rawType == Boolean.TYPE) { return new BooleanDeser(); } if (rawType == Character.TYPE) { return new CharDeser(); } throw new IllegalStateException(); }
public static JsonDeserializer<?> forType(Class<?> rawType) { // Start with more common types... if (rawType == Integer.TYPE) { return IntDeser.instance; } if (rawType == Long.TYPE) { return LongDeser.instance; } if (rawType == Byte.TYPE) { return new ByteDeser(); } if (rawType == Short.TYPE) { return new ShortDeser(); } if (rawType == Float.TYPE) { return new FloatDeser(); } if (rawType == Double.TYPE) { return new DoubleDeser(); } if (rawType == Boolean.TYPE) { return new BooleanDeser(); } if (rawType == Character.TYPE) { return new CharDeser(); } throw new IllegalStateException(); }
public static JsonDeserializer<?> forType(Class<?> rawType) { // Start with more common types... if (rawType == Integer.TYPE) { return IntDeser.instance; } if (rawType == Long.TYPE) { return LongDeser.instance; } if (rawType == Byte.TYPE) { return new ByteDeser(); } if (rawType == Short.TYPE) { return new ShortDeser(); } if (rawType == Float.TYPE) { return new FloatDeser(); } if (rawType == Double.TYPE) { return new DoubleDeser(); } if (rawType == Boolean.TYPE) { return new BooleanDeser(); } if (rawType == Character.TYPE) { return new CharDeser(); } throw new IllegalStateException(); }
public static JsonDeserializer<?> forType(Class<?> rawType) { // Start with more common types... if (rawType == Integer.TYPE) { return IntDeser.instance; } if (rawType == Long.TYPE) { return LongDeser.instance; } if (rawType == Byte.TYPE) { return new ByteDeser(); } if (rawType == Short.TYPE) { return new ShortDeser(); } if (rawType == Float.TYPE) { return new FloatDeser(); } if (rawType == Double.TYPE) { return new DoubleDeser(); } if (rawType == Boolean.TYPE) { return new BooleanDeser(); } if (rawType == Character.TYPE) { return new CharDeser(); } throw new IllegalStateException(); }
@Override protected byte[] handleSingleElementUnwrapped(JsonParser p, DeserializationContext ctxt) throws IOException { byte value; JsonToken t = p.getCurrentToken(); if (t == JsonToken.VALUE_NUMBER_INT || t == JsonToken.VALUE_NUMBER_FLOAT) { // should we catch overflow exceptions? value = p.getByteValue(); } else { // should probably accept nulls as 'false' if (t == JsonToken.VALUE_NULL) { if (_nuller != null) { _nuller.getNullValue(ctxt); return (byte[]) getEmptyValue(ctxt); } _verifyNullForPrimitive(ctxt); return null; } Number n = (Number) ctxt.handleUnexpectedToken(_valueClass.getComponentType(), p); value = n.byteValue(); } return new byte[] { value }; }
protected PrimitiveArrayDeserializers() { _allDeserializers = new HashMap<JavaType,JsonDeserializer<Object>>(); // note: we'll use component type as key, not array type add(boolean.class, new BooleanDeser()); /* ByteDeser is bit special, as it has 2 separate modes of operation; * one for String input (-> base64 input), the other for * numeric input */ add(byte.class, new ByteDeser()); add(short.class, new ShortDeser()); add(int.class, new IntDeser()); add(long.class, new LongDeser()); add(float.class, new FloatDeser()); add(double.class, new DoubleDeser()); add(String.class, new StringDeser()); /* also: char[] is most likely only used with Strings; doesn't * seem to make sense to transfer as numbers */ add(char.class, new CharDeser()); }
protected PrimitiveArrayDeserializers() { _allDeserializers = new HashMap<JavaType,JsonDeserializer<Object>>(); // note: we'll use component type as key, not array type add(boolean.class, new BooleanDeser()); /* ByteDeser is bit special, as it has 2 separate modes of operation; * one for String input (-> base64 input), the other for * numeric input */ add(byte.class, new ByteDeser()); add(short.class, new ShortDeser()); add(int.class, new IntDeser()); add(long.class, new LongDeser()); add(float.class, new FloatDeser()); add(double.class, new DoubleDeser()); add(String.class, new StringDeser()); /* also: char[] is most likely only used with Strings; doesn't * seem to make sense to transfer as numbers */ add(char.class, new CharDeser()); }
@Override protected PrimitiveArrayDeserializers<?> withResolved(Boolean unwrapSingle) { return new ByteDeser(this, unwrapSingle); }
@Override protected PrimitiveArrayDeserializers<?> withResolved(NullValueProvider nuller, Boolean unwrapSingle) { return new ByteDeser(this, nuller, unwrapSingle); }
@Override protected PrimitiveArrayDeserializers<?> withResolved(NullValueProvider nuller, Boolean unwrapSingle) { return new ByteDeser(this, nuller, unwrapSingle); }