本文整理匯總了Java中com.fasterxml.jackson.core.JsonParser.nextValue方法的典型用法代碼示例。如果您正苦於以下問題:Java JsonParser.nextValue方法的具體用法?Java JsonParser.nextValue怎麽用?Java JsonParser.nextValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.fasterxml.jackson.core.JsonParser
的用法示例。
在下文中一共展示了JsonParser.nextValue方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: processSegment
import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
protected T processSegment(JsonParser jp,
ISegmentAdapter<IBaseSegmentDTO, T> adapter) throws IOException {
if(jp.currentToken() != JsonToken.START_OBJECT) {
jp.nextValue();
}
IBaseSegmentDTO dto = jp.readValueAs(adapter.getDtoClass());
return adapter.adaptReverse(dto);
}
示例2: processSegment
import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
protected IBaseSegmentDTO processSegment(JsonParser jp,
ISegmentAdapter<IBaseSegmentDTO, T> adapter) throws IOException {
if(jp.currentToken() != JsonToken.START_OBJECT) {
jp.nextValue();
}
IBaseSegmentDTO dto = jp.readValueAs(adapter.getDtoClass());
return dto;
}
示例3: doMerge
import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
@Override
public void doMerge(JsonParser parser, int currentDepth, Message.Builder messageBuilder)
throws IOException {
Struct.Builder builder = (Struct.Builder) messageBuilder;
while ((parser.nextValue()) != JsonToken.END_OBJECT) {
builder.putFields(
parser.getCurrentName(), ValueMarshaller.INSTANCE.readValue(parser, currentDepth + 1));
}
}
示例4: deserialize
import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
@Override
public Object[] deserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException {
boolean flag = ctxt instanceof NettoDeserializationContext;
if (!flag) {
throw new JsonParseException(jp, "ctxt isn't NettoDeserializationContext!");
}
Map<String, String> headers = (Map<String, String>) ((NettoDeserializationContext) ctxt).getNettoHeaders();
ctxt = ((NettoDeserializationContext) ctxt).getContext();
String methodKey = headers.get(Constants.SERVICE_HEADER) + "/" + headers.get(Constants.METHOD_HEADER) + "/";
if (headers.containsKey(Constants.ARGSLEN_HEADER)) {
methodKey = methodKey + headers.get(Constants.ARGSLEN_HEADER);
}
Type[] types = null;
if (this.serviceMethodParameterTypesCache.containsKey(methodKey)) {
ServiceMethodDesc desc = this.serviceMethodParameterTypesCache.get(methodKey);
types = desc.types;
} else {
throw new JsonParseException(jp, "so such method:" + methodKey);
}
int length = types != null ? types.length : 0;
int currentIndex = 0;
Object[] args = new Object[length];
JsonToken currentToken = null;
while ((currentToken = jp.nextValue()) != null) {
switch (currentToken) {
case START_ARRAY:
continue;
case END_ARRAY:
return args;
default:
if (currentIndex < length) {
args[currentIndex] = ctxt.readValue(jp, mapper.getTypeFactory().constructType(types[currentIndex]));
currentIndex++;
}
}
}
return args;
}