下面列出了怎么用com.fasterxml.jackson.core.type.ResolvedType的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
@SuppressWarnings("TypeParameterUnusedInFormals")
public <T> T readValue(final JsonParser p, final ResolvedType valueType) throws IOException {
final T ret = delegate.readValue(p, valueType);
captured = ret;
return ret;
}
@Override
public <T> Iterator<T> readValues(final JsonParser p, final ResolvedType valueType) throws IOException {
final Iterator<T> ret = delegate.readValue(p, valueType);
captured = ret;
return ret;
}
@SuppressWarnings("unchecked")
@Override
public <T> T readValue(JsonParser p, ResolvedType type) throws IOException {
return (T) readValue(p, type.getRawClass());
}
/**
* Method to deserialize JSON content into a Java type, reference
* to which is passed as argument. Type is passed using
* Jackson specific type; instance of which can be constructed using
* {@link TypeFactory}.
*
* @throws IOException if a low-level I/O problem (unexpected end-of-input,
* network error) occurs (passed through as-is without additional wrapping -- note
* that this is one case where {@link DeserializationFeature#WRAP_EXCEPTIONS}
* does NOT result in wrapping of exception even if enabled)
* @throws JsonParseException if underlying input contains invalid content
* of type {@link JsonParser} supports (JSON for default case)
* @throws JsonMappingException if the input JSON structure does not match structure
* expected for result type (or has other mismatch issues)
*/
@Override
@SuppressWarnings("unchecked")
public final <T> T readValue(JsonParser p, ResolvedType valueType)
throws IOException, JsonParseException, JsonMappingException
{
return (T) _readValue(getDeserializationConfig(), p, (JavaType) valueType);
}
/**
* Convenience method, equivalent in function to:
*<pre>
* readerFor(valueType).readValues(p);
*</pre>
*<p>
* Method for reading sequence of Objects from parser stream.
* Sequence can be either root-level "unwrapped" sequence (without surrounding
* JSON array), or a sequence contained in a JSON Array.
* In either case {@link JsonParser} <b>MUST</b> point to the first token of
* the first element, OR not point to any token (in which case it is advanced
* to the next token). This means, specifically, that for wrapped sequences,
* parser MUST NOT point to the surrounding <code>START_ARRAY</code> (one that
* contains values to read) but rather to the token following it which is the first
* token of the first value to read.
*<p>
* Note that {@link ObjectReader} has more complete set of variants.
*/
@Override
public <T> MappingIterator<T> readValues(JsonParser p, ResolvedType valueType)
throws IOException, JsonProcessingException
{
return readValues(p, (JavaType) valueType);
}
/**
* Convenience method that binds content read using given parser, using
* configuration of this reader, except that expected value type
* is specified with the call (instead of currently configured root type).
* Value return is either newly constructed, or root value that
* was specified with {@link #withValueToUpdate(Object)}.
*<p>
* NOTE: this method never tries to auto-detect format, since actual
* (data-format specific) parser is given.
*/
@Override
@SuppressWarnings("unchecked")
public <T> T readValue(JsonParser p, ResolvedType valueType) throws IOException {
return (T) forType((JavaType)valueType).readValue(p);
}
/**
* Convenience method that is equivalent to:
*<pre>
* withType(valueType).readValues(p);
*</pre>
*<p>
* Method reads a sequence of Objects from parser stream.
* Sequence can be either root-level "unwrapped" sequence (without surrounding
* JSON array), or a sequence contained in a JSON Array.
* In either case {@link JsonParser} <b>MUST</b> point to the first token of
* the first element, OR not point to any token (in which case it is advanced
* to the next token). This means, specifically, that for wrapped sequences,
* parser MUST NOT point to the surrounding <code>START_ARRAY</code> (one that
* contains values to read) but rather to the token following it which is the first
* token of the first value to read.
*<p>
* NOTE: this method never tries to auto-detect format, since actual
* (data-format specific) parser is given.
*/
@Override
public <T> Iterator<T> readValues(JsonParser p, ResolvedType valueType) throws IOException {
return readValues(p, (JavaType) valueType);
}
/**
* Method to deserialize JSON content into a POJO, type specified
* with fully resolved type object (so it can be a generic type,
* including containers like {@link java.util.Collection} and
* {@link java.util.Map}).
*/
public abstract <T> T readValue(JsonParser p, ResolvedType valueType)
throws IOException;
/**
* Method for reading sequence of Objects from parser stream,
* all with same specified value type.
*/
public abstract <T> Iterator<T> readValues(JsonParser p, ResolvedType valueType)
throws IOException;
/**
* Method to deserialize JSON content into a POJO, type specified
* with fully resolved type object (so it can be a generic type,
* including containers like {@link java.util.Collection} and
* {@link java.util.Map}).
*/
public abstract <T> T readValue(JsonParser jp, ResolvedType valueType)
throws IOException, JsonProcessingException;
/**
* Method for reading sequence of Objects from parser stream,
* all with same specified value type.
*/
public abstract <T> Iterator<T> readValues(JsonParser jp, ResolvedType valueType)
throws IOException, JsonProcessingException;