Package org.codehaus.jackson.map

Examples of org.codehaus.jackson.map.JsonMappingException$Reference


                return _fromLongCreator.call1(Long.valueOf(value));
            }
        } catch (Exception e) {
            throw wrapException(e);
        }
        throw new JsonMappingException("Can not instantiate value of type "+getValueTypeDesc()
                +" from JSON integral number; no single-int-arg constructor/factory method");
    }
View Full Code Here


                return _fromLongCreator.call1(Long.valueOf(value));
            }
        } catch (Exception e) {
            throw wrapException(e);
        }
        throw new JsonMappingException("Can not instantiate value of type "+getValueTypeDesc()
                +" from JSON long integral number; no single-long-arg constructor/factory method");
    }
View Full Code Here

                return _fromDoubleCreator.call1(Double.valueOf(value));
            }
        } catch (Exception e) {
            throw wrapException(e);
        }
        throw new JsonMappingException("Can not instantiate value of type "+getValueTypeDesc()
                +" from JSON floating-point number; no one-double/Double-arg constructor/factory method");
    }
View Full Code Here

                return _fromBooleanCreator.call1(Boolean.valueOf(value));
            }
        } catch (Exception e) {
            throw wrapException(e);
        }
        throw new JsonMappingException("Can not instantiate value of type "+getValueTypeDesc()
                +" from JSON boolean value; no single-boolean/Boolean-arg constructor/factory method");
    }
View Full Code Here

    protected JsonMappingException wrapException(Throwable t)
    {
        while (t.getCause() != null) {
            t = t.getCause();
        }
        return new JsonMappingException("Instantiation of "+getValueTypeDesc()+" value failed: "+t.getMessage(), t);
    }
View Full Code Here

            throws IOException
    {
        String ns = jsonNode.get("namespace") != null ? jsonNode.get("namespace").getValueAsText() : null;
        String name = jsonNode.get("name") != null ? jsonNode.get("name").getValueAsText() : null;
        if (name == null) {
            throw new JsonMappingException("No name for DOM element was provided in the JSON object.");
        }
        Element element = document.createElementNS(ns, name);

        JsonNode attributesNode = jsonNode.get("attributes");
        if (attributesNode != null && attributesNode instanceof ArrayNode) {
View Full Code Here

                JavaType valueType = mapper.getTypeFactory().
                        constructType(new TypeReference<Map<String,PropertyValue<?>>>() { }.getType());
                DeserializerProvider provider = ctxt.getDeserializerProvider();
                JsonDeserializer<?> deser = provider.findTypedValueDeserializer(ctxt.getConfig(), valueType, null);
                if (deser == null) { // can this happen?
                    throw new JsonMappingException("Can not find a deserializer for type "+ valueType);
                }

                @SuppressWarnings({"unchecked"})
                Map<String, PropertyValue<?>> map = (Map<String, PropertyValue<?>>)deser.deserialize(jp, ctxt);
               
                return new NestedProperties(map);
            }
            case START_ARRAY:
            {
                JavaType valueType = mapper.getTypeFactory().
                        constructType(new TypeReference<List<String>>() { }.getType());
                DeserializerProvider provider = ctxt.getDeserializerProvider();
                JsonDeserializer<?> deser = provider.findTypedValueDeserializer(ctxt.getConfig(), valueType, null);
                if (deser == null) { // can this happen?
                    throw new JsonMappingException("Can not find a deserializer for type "+ valueType);
                }

                @SuppressWarnings({"unchecked"})
                List<String> list = (List<String>)deser.deserialize(jp, ctxt);
               
View Full Code Here

    {
        Object adapted;
        try {
            adapted = this.xmlAdapter.marshal(value);
        } catch (Exception e) {
            throw new JsonMappingException("Unable to use an XmlAdapter.", e);
        }
        JsonSerializer<Object> jsonSerializer = provider.findValueSerializer(adapted.getClass());
        jsonSerializer.serialize(adapted, jgen, provider);
    }
View Full Code Here

                    Method m = klass.getMethod(methodName, Multimap.class);
                    return (Multimap<?, ?>) m.invoke(null, map);
                }
                catch (SecurityException e)
                {
                    throw new JsonMappingException("Could not map to " + klass, e);
                }
                catch (NoSuchMethodException e) { }
                catch (IllegalAccessException e) { }
                catch (InvocationTargetException e)
                {
                    throw new JsonMappingException("Could not map to " + klass, e);
                }
            }
        }

        // If everything goes wrong, just give them the LinkedListMultimap...
View Full Code Here

    private void expect(JsonParser jp, JsonToken token) throws IOException
    {
        if (jp.getCurrentToken() != token)
        {
            throw new JsonMappingException("Expecting " + token + ", found " + jp.getCurrentToken(), jp.getCurrentLocation());
        }
    }
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.map.JsonMappingException$Reference

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.