Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.ObjectMapper.convertValue()


        ObjectMapper mapper = new ObjectMapper();
        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);

        CreateEnsembleOptions.Builder builder = mapper.convertValue(options, CreateEnsembleOptions.Builder.class);

        if (profileObject != null) {
            List profiles = mapper.convertValue(profileObject, List.class);
            builder.profiles(profiles);
        }
View Full Code Here


        mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);

        CreateEnsembleOptions.Builder builder = mapper.convertValue(options, CreateEnsembleOptions.Builder.class);

        if (profileObject != null) {
            List profiles = mapper.convertValue(profileObject, List.class);
            builder.profiles(profiles);
        }

        org.apache.felix.utils.properties.Properties userProps = null;
        try {
View Full Code Here

            throw new RuntimeException("Unknown provider type : " + providerType);
        }

        ObjectMapper mapper = getObjectMapper();

        builder = mapper.convertValue(options, builder.getClass());

        builder.zookeeperPassword(fabricService.getZookeeperPassword());
        builder.zookeeperUrl(fabricService.getZookeeperUrl());

        Object profileObject = options.get("profiles");
View Full Code Here

        builder.zookeeperUrl(fabricService.getZookeeperUrl());

        Object profileObject = options.get("profiles");

        if (profileObject != null) {
            List profiles = mapper.convertValue(profileObject, List.class);
            builder.profiles(profiles);
        }

        CreateContainerOptions build = builder.build();
View Full Code Here

      }
      if (((JsonNode) value).isNull()) {
        return null;
      }
      try {
        return mapper.convertValue(value, fullType);
      } catch (final Exception e) {
        final ClassCastException cce = new ClassCastException(
            "Failed to convert value:" + value + " -----> "
                + fullType);
        cce.initCause(e);
View Full Code Here

            if (metaModel.isEmbeddable(entityMetadata.getIdAttribute().getBindableJavaType())) {
                keyObj = metaModel.embeddable(entityMetadata.getIdAttribute().getBindableJavaType());
                key = JAXBUtils.toObject(id, keyObj.getJavaType(), mediaType);
            } else {
                ObjectMapper mapper = new ObjectMapper();
                key = mapper.convertValue(id, entityMetadata.getIdAttribute().getBindableJavaType());
            }
           
            entity = em.find(entityClass, key);
        } catch (Exception e) {
            log.error(e.getMessage());
View Full Code Here

            if (metaModel.isEmbeddable(entityMetadata.getIdAttribute().getBindableJavaType())) {
                keyObj = metaModel.embeddable(entityMetadata.getIdAttribute().getBindableJavaType());
                key = JAXBUtils.toObject(id, keyObj.getJavaType(), mediaType);
            } else {
                ObjectMapper mapper = new ObjectMapper();
                key = mapper.convertValue(id, entityMetadata.getIdAttribute().getBindableJavaType());
            }

            Object entity = em.find(entityClass, key);
            em.remove(entity);
        } catch (Exception e) {
View Full Code Here

    {
        /* Hmmh. Looks like XmlMapper has some issues with convertValue:
         * should investigate at some point. But not now...
         */
        final ObjectMapper jsonMapper = new ObjectMapper();
        String BIN1 = jsonMapper.convertValue("Hello".getBytes("UTF-8"), String.class);
        String BIN2 = jsonMapper.convertValue("world!!".getBytes("UTF-8"), String.class);
        String xml =
            "<TwoData>" +
                    "<data1><bytes>" + BIN1 + "</bytes></data1>" +
                    "<data2><bytes>" + BIN2 + "</bytes></data2>" +
View Full Code Here

        /* Hmmh. Looks like XmlMapper has some issues with convertValue:
         * should investigate at some point. But not now...
         */
        final ObjectMapper jsonMapper = new ObjectMapper();
        String BIN1 = jsonMapper.convertValue("Hello".getBytes("UTF-8"), String.class);
        String BIN2 = jsonMapper.convertValue("world!!".getBytes("UTF-8"), String.class);
        String xml =
            "<TwoData>" +
                    "<data1><bytes>" + BIN1 + "</bytes></data1>" +
                    "<data2><bytes>" + BIN2 + "</bytes></data2>" +
            "</TwoData>";
View Full Code Here

   * @param name the name
   * @param value the value
   */
  public void putParam(final String name, final Object value) {
    final ObjectMapper mapper = JOM.getInstance();
    req.with(PARAMS).put(name, mapper.convertValue(value, JsonNode.class));
  }
 
  /**
   * Gets the param.
   *
 
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.