@Override public ObjectCodec getCodec() { return delegate.getCodec(); }
/** * Method for reading sequence of Objects from parser stream, * all with same specified value type. * * @since 1.9 */ public <T> Iterator<T> readValuesAs(TypeReference<?> valueTypeRef) throws IOException, JsonProcessingException { ObjectCodec codec = getCodec(); if (codec == null) { throw new IllegalStateException("No ObjectCodec defined for the parser, can not deserialize JSON into Java objects"); } return codec.readValues(this, valueTypeRef); }
/** * Method for reading sequence of Objects from parser stream, * all with same specified value type. * * @since 1.9 */ public <T> Iterator<T> readValuesAs(Class<T> valueType) throws IOException, JsonProcessingException { ObjectCodec codec = getCodec(); if (codec == null) { throw new IllegalStateException("No ObjectCodec defined for the parser, can not deserialize JSON into Java objects"); } return codec.readValues(this, valueType); }
/** * Method to deserialize JSON content into equivalent "tree model", * represented by root {@link JsonNode} of resulting model. * For JSON Arrays it will an array node (with child nodes), * for objects object node (with child nodes), and for other types * matching leaf node type */ public JsonNode readValueAsTree() throws IOException, JsonProcessingException { ObjectCodec codec = getCodec(); if (codec == null) { throw new IllegalStateException("No ObjectCodec defined for the parser, can not deserialize JSON into JsonNode tree"); } return codec.readTree(this); }
@Override public TokenBuffer deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { TokenBuffer tb = new TokenBuffer(jp.getCodec()); // quite simple, given that TokenBuffer is a JsonGenerator: tb.copyCurrentStructure(jp); return tb; } }
/** * Method to deserialize JSON content into a non-container * type (it can be an array type, however): typically a bean, array * or a wrapper type (like {@link java.lang.Boolean}). * <b>Note</b>: method can only be called if the parser has * an object codec assigned; this is true for parsers constructed * by {@link org.codehaus.jackson.map.MappingJsonFactory} but * not for {@link JsonFactory} (unless its <code>setCodec</code> * method has been explicitly called). *<p> * This method may advance the event stream, for structured types * the current token will be the closing end marker (END_ARRAY, * END_OBJECT) of the bound structure. For non-structured Json types * (and for {@link JsonToken#VALUE_EMBEDDED_OBJECT}) * stream is not advanced. *<p> * Note: this method should NOT be used if the result type is a * container ({@link java.util.Collection} or {@link java.util.Map}. * The reason is that due to type erasure, key and value types * can not be introspected when using this method. */ public <T> T readValueAs(Class<T> valueType) throws IOException, JsonProcessingException { ObjectCodec codec = getCodec(); if (codec == null) { throw new IllegalStateException("No ObjectCodec defined for the parser, can not deserialize JSON into Java objects"); } return codec.readValue(this, valueType); }
throws IOException, JsonProcessingException ObjectCodec codec = getCodec(); if (codec == null) { throw new IllegalStateException("No ObjectCodec defined for the parser, can not deserialize JSON into Java objects");
/** * @param src Parser to use for accessing source information * like location, configured codec */ public JsonParser asParser(JsonParser src) { Parser p = new Parser(_first, src.getCodec()); p.setLocation(src.getTokenLocation()); return p; }
canDeserialize = (bean != null) && (_tokens[index] != null); } else { TokenBuffer tokens = new TokenBuffer(jp.getCodec()); tokens.copyCurrentStructure(jp); _tokens[index] = tokens;
@Override public ObjectCodec getCodec() { return delegate.getCodec(); }
@Override public ObjectCodec getCodec() { return parser.getCodec(); }
protected final void _deserialize(JsonParser jp, DeserializationContext ctxt, Object bean, int index) throws IOException, JsonProcessingException { /* Ok: time to mix type id, value; and we will actually use "wrapper-array" * style to ensure we can handle all kinds of JSON constructs. */ TokenBuffer merged = new TokenBuffer(jp.getCodec()); merged.writeStartArray(); merged.writeString(_typeIds[index]); JsonParser p2 = _tokens[index].asParser(jp); p2.nextToken(); merged.copyCurrentStructure(p2); merged.writeEndArray(); // needs to point to START_OBJECT (or whatever first token is) p2 = merged.asParser(jp); p2.nextToken(); _properties[index].getProperty().deserializeAndSet(p2, ctxt, bean); }
t = jp.nextToken(); TokenBuffer tokens = new TokenBuffer(jp.getCodec()); tokens.writeStartObject(); for (; t == JsonToken.FIELD_NAME; t = jp.nextToken()) {
TokenBuffer tokens = new TokenBuffer(jp.getCodec()); tokens.writeStartObject(); final Object bean = _valueInstantiator.createUsingDefault();
unknown = new TokenBuffer(jp.getCodec());
PropertyValueBuffer buffer = creator.startBuilding(jp, ctxt); TokenBuffer tokens = new TokenBuffer(jp.getCodec()); tokens.writeStartObject();
PropertyValueBuffer buffer = creator.startBuilding(jp, ctxt); TokenBuffer tokens = new TokenBuffer(jp.getCodec()); tokens.writeStartObject();
@Override public List<Rule> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { ObjectCodec oc = jp.getCodec(); JsonNode jsonNode = oc.readTree(jp); Iterator<JsonNode> childrenNodesIter=jsonNode.getElements(); List<Rule> rules=new ArrayList<Rule>(); while(childrenNodesIter.hasNext()){ JsonNode childNode=childrenNodesIter.next(); rules.add(parseRule(jp,childNode)); } return rules; } }
@Override public TokenBuffer deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { TokenBuffer tb = new TokenBuffer(jp.getCodec()); // quite simple, given that TokenBuffer is a JsonGenerator: tb.copyCurrentStructure(jp); return tb; } }
/** * @param src Parser to use for accessing source information * like location, configured codec */ public JsonParser asParser(JsonParser src) { Parser p = new Parser(_first, src.getCodec()); p.setLocation(src.getTokenLocation()); return p; }