private void readName() throws IOException, XMLStreamException { nextName(); tokenType = jsonReader.peek(); if (tokenType == JsonToken.BEGIN_OBJECT) { beginObject(); state = JsonState.NameName; } else if (tokenType == JsonToken.BEGIN_ARRAY) { beginArray(); tokenType = jsonReader.peek(); if (tokenType == JsonToken.BEGIN_OBJECT) { beginObject(); state = JsonState.NameName; } else { state = JsonState.NameValue; } } else if (tokenType == JsonToken.STRING || tokenType == JsonToken.NUMBER || tokenType == JsonToken.BOOLEAN || tokenType == JsonToken.NULL) { state = JsonState.NameValue; } }
private void stateTransition() throws XMLStreamException, IOException { if (state == JsonState.StartState) { beginObject(); JsonObject topElement = new JsonObject( "StackTopElement", JSONType.NESTED_OBJECT, null, "http://axis2.apache.org/axis/json"); stackObj.push(topElement); readName(); } else if (state == JsonState.NameName) { readName(); } else if (state == JsonState.NameValue) { readValue(); } else if (state == JsonState.ValueEndObject_END_1) { state = JsonState.ValueEndObject_END_2; removeStackObj(); } else if (state == JsonState.ValueEndObject_END_2) { readEndObject(); } else if (state == JsonState.ValueName_END) { state = JsonState.ValueName_START; removeStackObj(); } else if (state == JsonState.ValueName_START) { readName(); } else if (state == JsonState.ValueValue_END) { state = JsonState.ValueValue_START; } else if (state == JsonState.ValueValue_START) { value = null; state = JsonState.ValueValue_CHAR; } else if (state == JsonState.ValueValue_CHAR) { readValue(); } else if (state == JsonState.ValueEndArray) { readEndArray(); removeStackObj(); } else if (state == JsonState.EndArrayName) { readName(); } else if (state == JsonState.EndObjectEndObject) { readEndObject(); } else if (state == JsonState.EndObjectName) { readName(); } else if (state == JsonState.EndObjectBeginObject_END) { state = JsonState.EndObjectBeginObject_START; fillMiniList(); } else if (state == JsonState.EndObjectBeginObject_START) { readBeginObject(); } else if (state == JsonState.EndArrayEndObject) { readEndObject(); } }
private void readBeginObject() throws IOException, XMLStreamException { beginObject(); readName(); }