protected NullProvider(JavaType type, Object nullValue) { _nullValue = nullValue; // [JACKSON-420] _isPrimitive = type.isPrimitive(); _rawType = type.getRawClass(); }
protected boolean isNaturalTypeWithStdHandling(JavaType type, JsonSerializer<?> ser) { Class<?> cls = type.getRawClass(); // First: do we have a natural type being handled? if (type.isPrimitive()) { if (cls != Integer.TYPE && cls != Boolean.TYPE && cls != Double.TYPE) { return false; } } else { if (cls != String.class && cls != Integer.class && cls != Boolean.class && cls != Double.class) { return false; } } // Second: and it's handled with standard serializer? return (ser.getClass().getAnnotation(JacksonStdImpl.class)) != null; }
protected void _reportIncompatibleRootType(Object value, JavaType rootType) throws IOException, JsonProcessingException { /* 07-Jan-2010, tatu: As per [JACKSON-456] better handle distinction between wrapper types, * primitives */ if (rootType.isPrimitive()) { Class<?> wrapperType = ClassUtil.wrapperType(rootType.getRawClass()); // If it's just difference between wrapper, primitive, let it slide if (wrapperType.isAssignableFrom(value.getClass())) { return; } } throw new JsonMappingException("Incompatible types: declared root type ("+rootType+") vs " +value.getClass().getName()); }
public PropertyBasedCreator(ValueInstantiator valueInstantiator) { _valueInstantiator = valueInstantiator; _properties = new HashMap<String, SettableBeanProperty>(); // [JACKSON-372]: primitive types need extra care Object[] defValues = null; SettableBeanProperty[] creatorProps = valueInstantiator.getFromObjectArguments(); SettableBeanProperty[] propertiesWithInjectables = null; final int len = creatorProps.length; _propertyCount = len; for (int i = 0; i < len; ++i) { SettableBeanProperty prop = creatorProps[i]; _properties.put(prop.getName(), prop); if (prop.getType().isPrimitive()) { if (defValues == null) { defValues = new Object[len]; } defValues[i] = ClassUtil.defaultValue(prop.getType().getRawClass()); } Object injectableValueId = prop.getInjectableValueId(); if (injectableValueId != null) { if (propertiesWithInjectables == null) { propertiesWithInjectables = new SettableBeanProperty[len]; } propertiesWithInjectables[i] = prop; } } _defaultValues = defValues; _propertiesWithInjectables = propertiesWithInjectables; }
if (elemType.isPrimitive()) { // sanity check throw new IllegalArgumentException("Internal error: primitive type ("+type+") passed, no array deserializer found");
protected NullProvider(JavaType type, Object nullValue) { _nullValue = nullValue; // [JACKSON-420] _isPrimitive = type.isPrimitive(); _rawType = type.getRawClass(); }
protected boolean isNaturalTypeWithStdHandling(JavaType type, JsonSerializer<?> ser) { Class<?> cls = type.getRawClass(); // First: do we have a natural type being handled? if (type.isPrimitive()) { if (cls != Integer.TYPE && cls != Boolean.TYPE && cls != Double.TYPE) { return false; } } else { if (cls != String.class && cls != Integer.class && cls != Boolean.class && cls != Double.class) { return false; } } // Second: and it's handled with standard serializer? return (ser.getClass().getAnnotation(JacksonStdImpl.class)) != null; }
protected void _reportIncompatibleRootType(Object value, JavaType rootType) throws IOException, JsonProcessingException { /* 07-Jan-2010, tatu: As per [JACKSON-456] better handle distinction between wrapper types, * primitives */ if (rootType.isPrimitive()) { Class<?> wrapperType = ClassUtil.wrapperType(rootType.getRawClass()); // If it's just difference between wrapper, primitive, let it slide if (wrapperType.isAssignableFrom(value.getClass())) { return; } } throw new JsonMappingException("Incompatible types: declared root type ("+rootType+") vs " +value.getClass().getName()); }
public PropertyBasedCreator(ValueInstantiator valueInstantiator) { _valueInstantiator = valueInstantiator; _properties = new HashMap<String, SettableBeanProperty>(); // [JACKSON-372]: primitive types need extra care Object[] defValues = null; SettableBeanProperty[] creatorProps = valueInstantiator.getFromObjectArguments(); SettableBeanProperty[] propertiesWithInjectables = null; final int len = creatorProps.length; _propertyCount = len; for (int i = 0; i < len; ++i) { SettableBeanProperty prop = creatorProps[i]; _properties.put(prop.getName(), prop); if (prop.getType().isPrimitive()) { if (defValues == null) { defValues = new Object[len]; } defValues[i] = ClassUtil.defaultValue(prop.getType().getRawClass()); } Object injectableValueId = prop.getInjectableValueId(); if (injectableValueId != null) { if (propertiesWithInjectables == null) { propertiesWithInjectables = new SettableBeanProperty[len]; } propertiesWithInjectables[i] = prop; } } _defaultValues = defValues; _propertiesWithInjectables = propertiesWithInjectables; }
if (elemType.isPrimitive()) { // sanity check throw new IllegalArgumentException("Internal error: primitive type ("+type+") passed, no array deserializer found");
protected NullProvider(JavaType type, Object nullValue) { _nullValue = nullValue; // [JACKSON-420] _isPrimitive = type.isPrimitive(); _rawType = type.getRawClass(); }
protected NullProvider(JavaType type, Object nullValue) { _nullValue = nullValue; // [JACKSON-420] _isPrimitive = type.isPrimitive(); _rawType = type.getRawClass(); }
protected NullProvider(JavaType type, Object nullValue) { _nullValue = nullValue; // [JACKSON-420] _isPrimitive = type.isPrimitive(); _rawType = type.getRawClass(); }
protected boolean isNaturalTypeWithStdHandling(JavaType type, JsonSerializer<?> ser) { Class<?> cls = type.getRawClass(); // First: do we have a natural type being handled? if (type.isPrimitive()) { if (cls != Integer.TYPE && cls != Boolean.TYPE && cls != Double.TYPE) { return false; } } else { if (cls != String.class && cls != Integer.class && cls != Boolean.class && cls != Double.class) { return false; } } // Second: and it's handled with standard serializer? return (ser.getClass().getAnnotation(JacksonStdImpl.class)) != null; }
protected boolean isNaturalTypeWithStdHandling(JavaType type, JsonSerializer<?> ser) { Class<?> cls = type.getRawClass(); // First: do we have a natural type being handled? if (type.isPrimitive()) { if (cls != Integer.TYPE && cls != Boolean.TYPE && cls != Double.TYPE) { return false; } } else { if (cls != String.class && cls != Integer.class && cls != Boolean.class && cls != Double.class) { return false; } } // Second: and it's handled with standard serializer? return (ser.getClass().getAnnotation(JacksonStdImpl.class)) != null; }
protected boolean isNaturalTypeWithStdHandling(JavaType type, JsonSerializer<?> ser) { Class<?> cls = type.getRawClass(); // First: do we have a natural type being handled? if (type.isPrimitive()) { if (cls != Integer.TYPE && cls != Boolean.TYPE && cls != Double.TYPE) { return false; } } else { if (cls != String.class && cls != Integer.class && cls != Boolean.class && cls != Double.class) { return false; } } // Second: and it's handled with standard serializer? return (ser.getClass().getAnnotation(JacksonStdImpl.class)) != null; }
protected void _reportIncompatibleRootType(Object value, JavaType rootType) throws IOException, JsonProcessingException { /* 07-Jan-2010, tatu: As per [JACKSON-456] better handle distinction between wrapper types, * primitives */ if (rootType.isPrimitive()) { Class<?> wrapperType = ClassUtil.wrapperType(rootType.getRawClass()); // If it's just difference between wrapper, primitive, let it slide if (wrapperType.isAssignableFrom(value.getClass())) { return; } } throw new JsonMappingException("Incompatible types: declared root type ("+rootType+") vs " +value.getClass().getName()); }
protected void _reportIncompatibleRootType(Object value, JavaType rootType) throws IOException, JsonProcessingException { /* 07-Jan-2010, tatu: As per [JACKSON-456] better handle distinction between wrapper types, * primitives */ if (rootType.isPrimitive()) { Class<?> wrapperType = ClassUtil.wrapperType(rootType.getRawClass()); // If it's just difference between wrapper, primitive, let it slide if (wrapperType.isAssignableFrom(value.getClass())) { return; } } throw new JsonMappingException("Incompatible types: declared root type ("+rootType+") vs " +value.getClass().getName()); }
protected void _reportIncompatibleRootType(Object value, JavaType rootType) throws IOException, JsonProcessingException { /* 07-Jan-2010, tatu: As per [JACKSON-456] better handle distinction between wrapper types, * primitives */ if (rootType.isPrimitive()) { Class<?> wrapperType = ClassUtil.wrapperType(rootType.getRawClass()); // If it's just difference between wrapper, primitive, let it slide if (wrapperType.isAssignableFrom(value.getClass())) { return; } } throw new JsonMappingException("Incompatible types: declared root type ("+rootType+") vs " +value.getClass().getName()); }
@Override public JsonDeserializer<?> createArrayDeserializer(DeserializationConfig config, ArrayType type, DeserializerProvider p) throws JsonMappingException { JavaType elemType = type.getContentType(); // Very first thing: is deserializer hard-coded for elements? @SuppressWarnings("unchecked") JsonDeserializer<Object> contentDeser = (JsonDeserializer<Object>) elemType.getHandler(); if (contentDeser == null) { // Maybe special array type, such as "primitive" arrays (int[] etc) JsonDeserializer<Object> deser = _arrayDeserializers.get(elemType); if (deser != null) { return deser; } // If not, generic one: if (elemType.isPrimitive()) { // sanity check throw new IllegalArgumentException("Internal error: primitive type ("+type+") passed, no array deserializer found"); } // 'null' -> arrays have no referring fields contentDeser = p.findValueDeserializer(config, elemType, type, null); } return new ArrayDeserializer(type, contentDeser); }