Package org.codehaus.jackson.node

Examples of org.codehaus.jackson.node.TextNode


    case LONG:
      return new LongNode(in.readLong());
    case DOUBLE:
      return new DoubleNode(in.readDouble());
    case STRING:
      return new TextNode(in.readString());
    case BOOLEAN:
      return in.readBoolean() ? BooleanNode.TRUE : BooleanNode.FALSE;
    case NULL:
      in.readNull();
      return NullNode.getInstance();
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 = ( ( ObjectNode ) tree ).getFields();
    while ( nodeIterator.hasNext() ) {
      Map.Entry<String, JsonNode> jsonNode = nodeIterator.next();
      newProps.put( jsonNode.getKey(), jsonNode.getValue() );
View Full Code Here

            }
        }
    }
   
    private void deserializeExtension(PackageManifest manifest, Extension extension, ObjectNode node) {
        TextNode conditionNode = (TextNode) node.get("condition");
        if (conditionNode != null) {
            Condition condition = new Condition(conditionNode.getValueAsText(), manifest.getPackagePath() != null ? manifest.getPackagePath() + "/" + extension.getName() : null);
            extension.setCondition(condition);
        }
       
        ArrayNode dependencies = (ArrayNode) node.get("includes");
        if (dependencies == null) {
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));
    fields.add(new Field("optionalInt", Schema.createUnion
                         (Arrays.asList(Schema.create(Type.NULL),
                                        Schema.create(Type.INT))),
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, Charsets.UTF_8 ) );

    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

        } else if (obj instanceof Float) {
            return new DoubleNode((Float) obj);
        } else if (obj instanceof Boolean) {
            return BooleanNode.valueOf((Boolean) obj);
        } else {
            return new TextNode(obj.toString());
        }
    }
View Full Code Here

        List<Field> fields = new ArrayList<Field>();
        fields.add(new Field("id", Schema.create(Type.INT), null, null));
        fields.add(new Field("age", Schema.create(Type.INT), null, null));
        fields.add(new Field("fname", Schema.create(Type.STRING), null, null));
        fields.add(new Field("lname", Schema.create(Type.STRING), null, null));
        fields.add(new Field("title", Schema.create(Type.STRING), null, new TextNode("")));
       
        Schema schema = Schema.createRecord("Person", null, "avro.test", false);
        schema.setFields(fields);
       
        return schema;
View Full Code Here

    for (Entry<String, List<String>> entry : entrySet) {
      String key = entry.getKey();
      JsonNode value = null;

      if (1 == entry.getValue().size()) {
        value = new TextNode(entry.getValue().get(0));
      } else {
        ArrayNode arrayNode = objectMapper.createArrayNode();

        for (String v : entry.getValue())
          arrayNode.add(v);
View Full Code Here

    for (Entry<String, List<String>> entry : entrySet) {
      String key = entry.getKey();
      JsonNode value = null;

      if (1 == entry.getValue().size()) {
        value = new TextNode(entry.getValue().get(0));
      } else {
        ArrayNode arrayNode = objectMapper.createArrayNode();

        for (String v : entry.getValue())
          arrayNode.add(v);
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 = ( ( ObjectNode ) tree ).getFields();
    while ( nodeIterator.hasNext() ) {
      Map.Entry<String, JsonNode> jsonNode = nodeIterator.next();
      newProps.put( jsonNode.getKey(), jsonNode.getValue() );
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.