Package org.codehaus.jackson.map

Examples of org.codehaus.jackson.map.ObjectReader


  public static ObjectReader createReader(Type type)
  {
    ObjectMapper mapper = getObjectMapper(type);
    setGlobalConfigurations(mapper);
    JavaType paramJavaType = mapper.getTypeFactory().constructType(type);
    ObjectReader reader = mapper.reader(paramJavaType);
    return reader;
  }
View Full Code Here


  public static void extractMetricsFromJmxBean(InputStream jmxStream, String jmxUrl,
                                               Map<String, String> jmxProperties,
                                               Map<String, Metric> metrics) {
    ObjectMapper jmxObjectMapper = new ObjectMapper();
    jmxObjectMapper.configure(DeserializationConfig.Feature.USE_ANNOTATIONS, false);
    ObjectReader jmxObjectReader = jmxObjectMapper.reader(JMXMetricHolder.class);
    JMXMetricHolder metricHolder = null;
    try {
      metricHolder = jmxObjectReader.readValue(jmxStream);
    } catch (IOException e) {
      logger.error(String.format("Malformed jmx data from %s. Error %s", jmxUrl, e.getMessage()));
    }

    Map<String, Map<String, Object>> categories = new HashMap<String, Map<String, Object>>();
View Full Code Here

    private ObjectMapper mapper = new ObjectMapper();

    public void toObject(Reader in, Object target) throws IOException {

        mapper.configure(Feature.WRITE_NULL_MAP_VALUES, false);
        ObjectReader or = mapper.readerForUpdating(target);
        or.readValue(in); //, new TypeReference<clazz>);
    }
View Full Code Here

        return mapper.writerWithView(type).writeValueAsString(src);
    }

    @Override
    public <T> T deSer(String src, Class<T> type) throws Exception {
        ObjectReader reader = mapper.reader(type);
        return reader.readValue(src);
    }
View Full Code Here

    }
  }

  public static boolean update(final Object value, final String json) {
    try {
      final ObjectReader reader = mapper.updatingReader(value);
      reader.readValue(json);
      return true;
    } catch (Exception e) {
      log.error("", e);
      return false;
    }
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.map.ObjectReader

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.