Пример #1
0
 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();
   }
 }
Пример #2
0
 private void readEndObject() throws IOException, XMLStreamException {
   endObject();
   tokenType = jsonReader.peek();
   if (tokenType == JsonToken.END_OBJECT) {
     removeStackObj();
     state = JsonState.EndObjectEndObject;
   } else if (tokenType == JsonToken.END_ARRAY) {
     readEndArray();
     removeStackObj();
   } else if (tokenType == JsonToken.NAME) {
     removeStackObj();
     state = JsonState.EndObjectName;
   } else if (tokenType == JsonToken.BEGIN_OBJECT) {
     state = JsonState.EndObjectBeginObject_END;
   } else if (tokenType == JsonToken.END_DOCUMENT) {
     removeStackObj();
     state = JsonState.EndObjectEndDocument;
   }
 }