本文整理匯總了Java中org.codehaus.jackson.JsonToken.START_ARRAY屬性的典型用法代碼示例。如果您正苦於以下問題:Java JsonToken.START_ARRAY屬性的具體用法?Java JsonToken.START_ARRAY怎麽用?Java JsonToken.START_ARRAY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.codehaus.jackson.JsonToken
的用法示例。
在下文中一共展示了JsonToken.START_ARRAY屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parse
public void parse(HttpRequest req) throws IOException {
final JsonParser parser = jsonFactory.createJsonParser(
new ChannelBufferInputStream(req.getContent()));
parser.nextToken(); // Skip the wrapper
while (parser.nextToken() != JsonToken.END_OBJECT) {
final String metric = parser.getCurrentName();
JsonToken currentToken = parser.nextToken();
if (currentToken == JsonToken.START_OBJECT) {
parseMetricObject(metric, parser);
} else if (currentToken == JsonToken.START_ARRAY) {
int illegalTokens = parseMetricArray(metric, parser);
if(illegalTokens > 0) {
logger.warn("{} illegal tokens encountered", illegalTokens);
}
} else {
logger.warn("Illegal token: expected {} or {}, but was {}: {}",new Object[] {
JsonToken.START_OBJECT, JsonToken.START_ARRAY, currentToken, parser.getText()});
}
}
}
示例2: BackportedJacksonMappingIterator
@SuppressWarnings("unchecked")
protected BackportedJacksonMappingIterator(JavaType type, JsonParser jp, DeserializationContext ctxt, JsonDeserializer<?> deser) {
_type = type;
_parser = jp;
_context = ctxt;
_deserializer = (JsonDeserializer<T>) deser;
/* One more thing: if we are at START_ARRAY (but NOT root-level
* one!), advance to next token (to allow matching END_ARRAY)
*/
if (jp != null && jp.getCurrentToken() == JsonToken.START_ARRAY) {
JsonStreamContext sc = jp.getParsingContext();
// safest way to skip current token is to clear it (so we'll advance soon)
if (!sc.inRoot()) {
jp.clearCurrentToken();
}
}
}
示例3: _nextAfterName
private final JsonToken _nextAfterName()
{
this._nameCopied = false;
JsonToken localJsonToken = this._nextToken;
this._nextToken = null;
if (localJsonToken == JsonToken.START_ARRAY)
this._parsingContext = this._parsingContext.createChildArrayContext(this._tokenInputRow, this._tokenInputCol);
while (true)
{
this._currToken = localJsonToken;
return localJsonToken;
if (localJsonToken != JsonToken.START_OBJECT)
continue;
this._parsingContext = this._parsingContext.createChildObjectContext(this._tokenInputRow, this._tokenInputCol);
}
}
示例4: TreeTraversingParser
public TreeTraversingParser(JsonNode paramJsonNode, ObjectCodec paramObjectCodec)
{
super(0);
this._objectCodec = paramObjectCodec;
if (paramJsonNode.isArray())
{
this._nextToken = JsonToken.START_ARRAY;
this._nodeCursor = new NodeCursor.Array(paramJsonNode, null);
return;
}
if (paramJsonNode.isObject())
{
this._nextToken = JsonToken.START_OBJECT;
this._nodeCursor = new NodeCursor.Object(paramJsonNode, null);
return;
}
this._nodeCursor = new NodeCursor.RootValue(paramJsonNode, null);
}
示例5: readArrayStart
@Override
public long readArrayStart() throws IOException {
advance(Symbol.ARRAY_START);
if (in.getCurrentToken() == JsonToken.START_ARRAY) {
in.nextToken();
return doArrayNext();
} else {
throw error("array-start");
}
}
示例6: skipArray
@Override
public long skipArray() throws IOException {
advance(Symbol.ARRAY_START);
if (in.getCurrentToken() == JsonToken.START_ARRAY) {
in.skipChildren();
in.nextToken();
advance(Symbol.ARRAY_END);
} else {
throw error("array-start");
}
return 0;
}
示例7: registJsonEntityData
/**
* 10_relations.json, 20_roles.json, 30_extroles.json, 70_$links.json, 10_odatarelations.jsonのバリデートチェック.
* @param jp Jsonパース
* @param mapper ObjectMapper
* @param jsonName ファイル名
* @throws IOException IOException
*/
protected void registJsonEntityData(JsonParser jp, ObjectMapper mapper, String jsonName) throws IOException {
JsonToken token;
token = jp.nextToken();
// Relations,Roles,ExtRoles,$linksのチェック
checkMatchFieldName(jp, jsonName);
token = jp.nextToken();
// 配列でなければエラー
if (token != JsonToken.START_ARRAY) {
throw PersoniumCoreException.BarInstall.JSON_FILE_FORMAT_ERROR.params(jsonName);
}
token = jp.nextToken();
while (jp.hasCurrentToken()) {
if (token == JsonToken.END_ARRAY) {
break;
} else if (token != JsonToken.START_OBJECT) {
throw PersoniumCoreException.BarInstall.JSON_FILE_FORMAT_ERROR.params(jsonName);
}
// 1件登録処理
JSONMappedObject mappedObject = barFileJsonValidate(jp, mapper, jsonName);
if (jsonName.equals(RELATION_JSON)) {
createRelation(mappedObject.getJson());
} else if (jsonName.equals(ROLE_JSON)) {
createRole(mappedObject.getJson());
} else if (jsonName.equals(EXTROLE_JSON)) {
createExtRole(mappedObject.getJson());
} else if (jsonName.equals(LINKS_JSON)) {
createLinks(mappedObject, odataProducer);
}
token = jp.nextToken();
}
}
示例8: readArrayStart
@Override
public long readArrayStart() throws IOException {
advance(Symbol.ARRAY_START);
if (in.getCurrentToken() == JsonToken.START_ARRAY) {
in.nextToken();
return doArrayNext();
} else {
throw error("array-start");
}
}
示例9: skipArray
@Override
public long skipArray() throws IOException {
advance(Symbol.ARRAY_START);
if (in.getCurrentToken() == JsonToken.START_ARRAY) {
in.skipChildren();
in.nextToken();
advance(Symbol.ARRAY_END);
} else {
throw error("array-start");
}
return 0;
}
示例10: processing
public void processing(Callback callback) throws IOException {
JsonToken current = parser.nextToken();
/** the following read from a big json array **/
if (current == JsonToken.START_ARRAY) {
// For each of the records in the array
while (parser.nextToken() != JsonToken.END_ARRAY) {
// read the record into a tree model,
// this moves the parsing position to the end of it
JsonNode node = parser.readValueAsTree();
callback.processSingleJSONRecord(node);
}
}
}
示例11: ingestArray
public int ingestArray(String type, Class c, Map<String,EngineType> typeinfo,
JsonParser p) {
int count = 0;
try {
if(p.getCurrentToken() != JsonToken.START_ARRAY) return 0;
p.nextToken();
while(p.getCurrentToken() != JsonToken.END_ARRAY) {
count += ingestObject(type, c, typeinfo, p);
}
p.nextToken();
}
catch(IOException e) { logger.error(e); }
catch(EngineJSONUtil.MalformedEngineJSON je) { logger.error(je); }
return count;
}
示例12: deserializeTypedFromAny
public Object deserializeTypedFromAny(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
if (paramJsonParser.getCurrentToken() == JsonToken.START_ARRAY)
return super.deserializeTypedFromArray(paramJsonParser, paramDeserializationContext);
return deserializeTypedFromObject(paramJsonParser, paramDeserializationContext);
}
示例13: MappingIterator
protected MappingIterator(JavaType paramJavaType, JsonParser paramJsonParser, DeserializationContext paramDeserializationContext, JsonDeserializer<?> paramJsonDeserializer)
{
this._type = paramJavaType;
this._parser = paramJsonParser;
this._context = paramDeserializationContext;
this._deserializer = paramJsonDeserializer;
if ((paramJsonParser != null) && (paramJsonParser.getCurrentToken() == JsonToken.START_ARRAY) && (!paramJsonParser.getParsingContext().inRoot()))
paramJsonParser.clearCurrentToken();
}
示例14: getCurrentName
public String getCurrentName()
throws IOException, JsonParseException
{
if ((this._currToken == JsonToken.START_OBJECT) || (this._currToken == JsonToken.START_ARRAY))
return this._parsingContext.getParent().getCurrentName();
return this._parsingContext.getCurrentName();
}
示例15: skipChildren
public JsonParser skipChildren()
throws IOException, JsonParseException
{
if (this._currToken == JsonToken.START_OBJECT)
{
this._startContainer = false;
this._currToken = JsonToken.END_OBJECT;
}
do
return this;
while (this._currToken != JsonToken.START_ARRAY);
this._startContainer = false;
this._currToken = JsonToken.END_ARRAY;
return this;
}