Package org.codehaus.jackson.map

Examples of org.codehaus.jackson.map.ObjectMapper.constructType()


        }

        try {
            Class<?> cls = context.getTargetDataType().getPhysical();
            ObjectMapper mapper = JacksonHelper.createObjectMapper(cls);
            JavaType javaType = mapper.constructType(context.getTargetDataType().getGenericType());
            if (source instanceof String) {
              String sourceString = (String) source;
              if(sourceString.isEmpty()) {
                return sourceString;
              } else {
View Full Code Here


public class JacksonParser implements Parser {
    @Override
    public <T> T parse(byte[] data, Type type) {
        ObjectMapper mapper = new ObjectMapper();
        mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        JavaType javaType = mapper.constructType(type);
        try {
            return mapper.readValue(data, javaType);
        } catch (IOException e) {
            throw new ParseException("Unable to parse data.", e);
        }
View Full Code Here

        }

        // Finally: if we really want to verify that we can serialize, we'll check:
        if (_cfgCheckCanSerialize) {
            ObjectMapper mapper = locateMapper(type, mediaType);
            if (!mapper.canDeserialize(mapper.constructType(type))) {
                return false;
            }
        }
        return true;
    }
View Full Code Here

        JsonParser jp = mapper.getJsonFactory().createJsonParser(entityStream);
        /* Important: we are NOT to close the underlying stream after
         * mapping, so we need to instruct parser:
         */
        jp.disable(JsonParser.Feature.AUTO_CLOSE_SOURCE);
        return mapper.readValue(jp, mapper.constructType(genericType));
    }

    /*
    /**********************************************************
    /* MessageBodyWriter impl
View Full Code Here

        }

        try {
            Class<?> cls = context.getTargetDataType().getPhysical();
            ObjectMapper mapper = JacksonHelper.createObjectMapper(cls);
            JavaType javaType = mapper.constructType(context.getTargetDataType().getGenericType());
            if (source instanceof String) {
              String sourceString = (String) source;
              if(sourceString.isEmpty()) {
                return sourceString;
              } else {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.