Package org.codehaus.jackson.util

Examples of org.codehaus.jackson.util.TokenBuffer


        // sanity check for null first:
        if (fromValue == null) return null;
        /* Then use TokenBuffer, which is a JsonGenerator:
         * (see [JACKSON-175])
         */
        TokenBuffer buf = new TokenBuffer(this);
        try {
            writeValue(buf, fromValue);
            // and provide as with a JsonParser for contents as well!
            JsonParser jp = buf.asParser();
            Object result = readValue(jp, toValueType);
            jp.close();
            return result;
        } catch (IOException e) { // should not occur, no real i/o...
            throw new IllegalArgumentException(e.getMessage(), e);
View Full Code Here


  @Override
  public final <_Object_ extends Object> Object encode (final _Object_ object, final Class<_Object_> clasz)
  {
    try {
      final ObjectMapper mapper = new ObjectMapper ();
      final TokenBuffer buffer = new TokenBuffer (mapper);
      mapper.viewWriter (clasz).writeValue (buffer, object);
      final JsonParser parser = buffer.asParser ();
      final JsonNode node = mapper.readTree (parser);
      parser.close ();
      final Object data = this.transformFromNode (node);
      return (data);
    } catch (final IOException exception) {
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.util.TokenBuffer

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.