Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.fasterxml.jackson.databind.node;
  
  
  
This intermediate base class is used for all container nodes, specifically, array and object nodes.
 
 public abstract class ContainerNode<T extends ContainerNode<T>>
     extends BaseJsonNode
 {
    
We will keep a reference to the Object (usually TreeMapper) that can construct instances of nodes to add to this container node.
 
     protected final JsonNodeFactory _nodeFactory;
 
     protected ContainerNode(JsonNodeFactory nc)
     {
          = nc;
     }
 
     // all containers are mutable: can't define:
 //    @Override public abstract <T extends JsonNode> T deepCopy();
 
     @Override
     public abstract JsonToken asToken();
     
     @Override
     public String asText() { return ""; }
 
     /*
     /**********************************************************
     /* Methods reset as abstract to force real implementation
     /**********************************************************
      */
 
     @Override
     public abstract int size();
 
     @Override
     public abstract JsonNode get(int index);
 
     @Override
     public abstract JsonNode get(String fieldName);
 
     /*
     /**********************************************************
     /* NodeCreator implementation, just dispatch to
     /* the real creator
     /**********************************************************
      */

    
Factory method that constructs and returns an empty ArrayNode Construction is done using registered JsonNodeFactory.
 
     public final ArrayNode arrayNode() { return .arrayNode(); }

    
Factory method that constructs and returns an empty ObjectNode Construction is done using registered JsonNodeFactory.
 
     public final ObjectNode objectNode() { return .objectNode(); }
 
     public final NullNode nullNode() { return .nullNode(); }
 
     public final BooleanNode booleanNode(boolean v) { return .booleanNode(v); }
 
     public final NumericNode numberNode(byte v) { return .numberNode(v); }
     public final NumericNode numberNode(short v) { return .numberNode(v); }
     public final NumericNode numberNode(int v) { return .numberNode(v); }
     public final NumericNode numberNode(long v) { return .numberNode(v); }
     public final NumericNode numberNode(float v) { return .numberNode(v); }
     public final NumericNode numberNode(double v) { return .numberNode(v); }
     public final NumericNode numberNode(BigDecimal v) { return (.numberNode(v)); }
 
     public final TextNode textNode(String text) { return .textNode(text); }
 
     public final BinaryNode binaryNode(byte[] data) { return .binaryNode(data); }
     public final BinaryNode binaryNode(byte[] dataint offsetint length) { return .binaryNode(dataoffsetlength); }
 
     public final POJONode POJONode(Object pojo) { return .POJONode(pojo); }
 
     /*
     /**********************************************************
     /* Common mutators
     /**********************************************************
      */

    
Method for removing all children container has (if any)

Returns:
Container node itself (to allow method call chaining)
    public abstract T removeAll();
    /*
    /**********************************************************
    /* Helper classes
    /**********************************************************
     */
New to GrepCode? Check out our FAQ X