Package org.codehaus.jackson.node

Examples of org.codehaus.jackson.node.TextNode


  @NonNls
  public static String addTypeInformation( @NotNull @NonNls String type, @NotNull Version version, @NotNull @NonNls byte[] xmlBytes ) throws Exception {
    JsonNode tree = new ObjectMapper().readTree( new String( xmlBytes ) );

    Map<String, JsonNode> newProps = new LinkedHashMap<String, JsonNode>();
    newProps.put( "@type", new TextNode( type ) );
    newProps.put( "@version", new TextNode( version.format() ) );

    Iterator<Map.Entry<String, JsonNode>> nodeIterator = ( ( ObjectNode ) tree ).getFields();
    while ( nodeIterator.hasNext() ) {
      Map.Entry<String, JsonNode> jsonNode = nodeIterator.next();
      newProps.put( jsonNode.getKey(), jsonNode.getValue() );
View Full Code Here


  public static String addTypeInformation( @Nonnull String type, @Nonnull Version version, @Nonnull byte[] xmlBytes ) throws Exception {
    JsonNode tree = new ObjectMapper().readTree( new String( xmlBytes ) );

    Map<String, JsonNode> newProps = new LinkedHashMap<String, JsonNode>();
    newProps.put( "@type", new TextNode( type ) );
    newProps.put( "@version", new TextNode( version.format() ) );

    Iterator<Map.Entry<String, JsonNode>> nodeIterator = tree.getFields();
    while ( nodeIterator.hasNext() ) {
      Map.Entry<String, JsonNode> jsonNode = nodeIterator.next();
      newProps.put( jsonNode.getKey(), jsonNode.getValue() );
View Full Code Here

  }
 
  /** Creates a test record schema */
  private static Schema recordSchema() {
    List<Field> fields = new ArrayList<Field>();
    fields.add(new Field("id", Schema.create(Type.STRING), null, new TextNode("0")));
    fields.add(new Field("intField", Schema.create(Type.INT), null, null));
    fields.add(new Field("anArray", Schema.createArray(Schema.create(Type.STRING)), null, null));
    Schema schema = Schema.createRecord("Foo", "test", "mytest", false);
    schema.setFields(fields);
    return schema;
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.node.TextNode

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.