Java Code Examples for com.amazonaws.transform.JsonUnmarshallerContext#getCurrentDepth()

The following examples show how to use com.amazonaws.transform.JsonUnmarshallerContext#getCurrentDepth() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UpdateApplicationResultJsonUnmarshaller.java    From realworld-serverless-application with Apache License 2.0 6 votes vote down vote up
public UpdateApplicationResult unmarshall(JsonUnmarshallerContext context) throws Exception {
  UpdateApplicationResult updateApplicationResult = new UpdateApplicationResult();

  int originalDepth = context.getCurrentDepth();
  String currentParentElement = context.getCurrentParentElement();
  int targetDepth = originalDepth + 1;

  JsonToken token = context.getCurrentToken();
  if (token == null)
    token = context.nextToken();
  if (token == VALUE_NULL) {
    return updateApplicationResult;
  }

  while (true) {
    if (token == null)
      break;

    updateApplicationResult.setApplication(ApplicationJsonUnmarshaller.getInstance().unmarshall(context));
    token = context.nextToken();
  }

  return updateApplicationResult;
}
 
Example 2
Source File: ListApplicationsResultJsonUnmarshaller.java    From realworld-serverless-application with Apache License 2.0 6 votes vote down vote up
public ListApplicationsResult unmarshall(JsonUnmarshallerContext context) throws Exception {
  ListApplicationsResult listApplicationsResult = new ListApplicationsResult();

  int originalDepth = context.getCurrentDepth();
  String currentParentElement = context.getCurrentParentElement();
  int targetDepth = originalDepth + 1;

  JsonToken token = context.getCurrentToken();
  if (token == null)
    token = context.nextToken();
  if (token == VALUE_NULL) {
    return listApplicationsResult;
  }

  while (true) {
    if (token == null)
      break;

    listApplicationsResult.setApplicationList(ApplicationListJsonUnmarshaller.getInstance().unmarshall(context));
    token = context.nextToken();
  }

  return listApplicationsResult;
}
 
Example 3
Source File: CreateApplicationResultJsonUnmarshaller.java    From realworld-serverless-application with Apache License 2.0 6 votes vote down vote up
public CreateApplicationResult unmarshall(JsonUnmarshallerContext context) throws Exception {
  CreateApplicationResult createApplicationResult = new CreateApplicationResult();

  int originalDepth = context.getCurrentDepth();
  String currentParentElement = context.getCurrentParentElement();
  int targetDepth = originalDepth + 1;

  JsonToken token = context.getCurrentToken();
  if (token == null)
    token = context.nextToken();
  if (token == VALUE_NULL) {
    return createApplicationResult;
  }

  while (true) {
    if (token == null)
      break;

    createApplicationResult.setApplication(ApplicationJsonUnmarshaller.getInstance().unmarshall(context));
    token = context.nextToken();
  }

  return createApplicationResult;
}
 
Example 4
Source File: GetApplicationResultJsonUnmarshaller.java    From realworld-serverless-application with Apache License 2.0 6 votes vote down vote up
public GetApplicationResult unmarshall(JsonUnmarshallerContext context) throws Exception {
  GetApplicationResult getApplicationResult = new GetApplicationResult();

  int originalDepth = context.getCurrentDepth();
  String currentParentElement = context.getCurrentParentElement();
  int targetDepth = originalDepth + 1;

  JsonToken token = context.getCurrentToken();
  if (token == null)
    token = context.nextToken();
  if (token == VALUE_NULL) {
    return getApplicationResult;
  }

  while (true) {
    if (token == null)
      break;

    getApplicationResult.setApplication(ApplicationJsonUnmarshaller.getInstance().unmarshall(context));
    token = context.nextToken();
  }

  return getApplicationResult;
}
 
Example 5
Source File: ApplicationListJsonUnmarshaller.java    From realworld-serverless-application with Apache License 2.0 5 votes vote down vote up
public ApplicationList unmarshall(JsonUnmarshallerContext context) throws Exception {
  ApplicationList applicationList = new ApplicationList();

  int originalDepth = context.getCurrentDepth();
  String currentParentElement = context.getCurrentParentElement();
  int targetDepth = originalDepth + 1;

  JsonToken token = context.getCurrentToken();
  if (token == null)
    token = context.nextToken();
  if (token == VALUE_NULL) {
    return null;
  }

  while (true) {
    if (token == null)
      break;

    if (token == FIELD_NAME || token == START_OBJECT) {
      if (context.testExpression("applications", targetDepth)) {
        context.nextToken();
        applicationList.setApplications(new ListUnmarshaller<ApplicationSummary>(ApplicationSummaryJsonUnmarshaller.getInstance())
                .unmarshall(context));
      }
      if (context.testExpression("nextToken", targetDepth)) {
        context.nextToken();
        applicationList.setNextToken(context.getUnmarshaller(String.class).unmarshall(context));
      }
    } else if (token == END_ARRAY || token == END_OBJECT) {
      if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
        if (context.getCurrentDepth() <= originalDepth)
          break;
      }
    }
    token = context.nextToken();
  }

  return applicationList;
}
 
Example 6
Source File: ListLexiconsResultJsonUnmarshaller.java    From ivona-speechcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
public ListLexiconsResult unmarshall(JsonUnmarshallerContext context) throws Exception {
    ListLexiconsResult listLexiconsResult = new ListLexiconsResult();

    int originalDepth = context.getCurrentDepth();
    String currentParentElement = context.getCurrentParentElement();
    int targetDepth = originalDepth + 1;

    JsonToken token = context.getCurrentToken();
    if (token == null) {
        token = context.nextToken();
    }
    if (token == VALUE_NULL) {
        return null;
    }

    while (true) {
        if (token == null) {
            break;
        }

        if (token == FIELD_NAME || token == START_OBJECT) {
            if (context.testExpression(JSON_KEY_LEXICONS, targetDepth)) {
                listLexiconsResult.setLexiconNames(new ListUnmarshaller<String>(
                        SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller.getInstance()).unmarshall(context));
            }
        } else if (token == END_ARRAY || token == END_OBJECT) {
            if (context.getLastParsedParentElement() == null
                    || context.getLastParsedParentElement().equals(currentParentElement)) {
                if (context.getCurrentDepth() <= originalDepth) {
                    break;
                }
            }
        }

        token = context.nextToken();
    }

    return listLexiconsResult;
}
 
Example 7
Source File: GetLexiconResultJsonUnmarshaller.java    From ivona-speechcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
public GetLexiconResult unmarshall(JsonUnmarshallerContext context) throws Exception {
    GetLexiconResult getLexiconResult = new GetLexiconResult();

    int originalDepth = context.getCurrentDepth();
    String currentParentElement = context.getCurrentParentElement();
    int targetDepth = originalDepth + 1;

    JsonToken token = context.getCurrentToken();
    if (token == null) {
        token = context.nextToken();
    }
    if (token == VALUE_NULL) {
        return null;
    }

    while (true) {
        if (token == null) {
            break;
        }

        if (token == FIELD_NAME || token == START_OBJECT) {
            if (context.testExpression(JSON_KEY_LEXICON, targetDepth)) {
                context.nextToken();
                getLexiconResult.setLexicon(LexiconJsonUnmarshaller.getInstance().unmarshall(context));
            }
        } else if (token == END_ARRAY || token == END_OBJECT) {
            if (context.getLastParsedParentElement() == null
                    || context.getLastParsedParentElement().equals(currentParentElement)) {
                if (context.getCurrentDepth() <= originalDepth) {
                    break;
                }
            }
        }

        token = context.nextToken();
    }

    return getLexiconResult;
}
 
Example 8
Source File: ListVoicesResultJsonUnmarshaller.java    From ivona-speechcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
public ListVoicesResult unmarshall(JsonUnmarshallerContext context) throws Exception {
    ListVoicesResult listVoicesResult = new ListVoicesResult();

    int originalDepth = context.getCurrentDepth();
    String currentParentElement = context.getCurrentParentElement();
    int targetDepth = originalDepth + 1;

    JsonToken token = context.getCurrentToken();
    if (token == null) {
        token = context.nextToken();
    }
    if (token == VALUE_NULL) {
        return null;
    }

    while (true) {
        if (token == null) {
            break;
        }

        if (token == FIELD_NAME || token == START_OBJECT) {
            if (context.testExpression(JSON_KEY_VOICES, targetDepth)) {
                listVoicesResult.setVoices(new ListUnmarshaller<Voice>(VoiceJsonUnmarshaller.getInstance())
                        .unmarshall(context));
            }
        } else if (token == END_ARRAY || token == END_OBJECT) {
            if (context.getLastParsedParentElement() == null
                    || context.getLastParsedParentElement().equals(currentParentElement)) {
                if (context.getCurrentDepth() <= originalDepth) {
                    break;
                }
            }
        }

        token = context.nextToken();
    }

    return listVoicesResult;
}
 
Example 9
Source File: ApplicationJsonUnmarshaller.java    From realworld-serverless-application with Apache License 2.0 4 votes vote down vote up
public Application unmarshall(JsonUnmarshallerContext context) throws Exception {
  Application application = new Application();

  int originalDepth = context.getCurrentDepth();
  String currentParentElement = context.getCurrentParentElement();
  int targetDepth = originalDepth + 1;

  JsonToken token = context.getCurrentToken();
  if (token == null)
    token = context.nextToken();
  if (token == VALUE_NULL) {
    return null;
  }

  while (true) {
    if (token == null)
      break;

    if (token == FIELD_NAME || token == START_OBJECT) {
      if (context.testExpression("applicationId", targetDepth)) {
        context.nextToken();
        application.setApplicationId(context.getUnmarshaller(String.class).unmarshall(context));
      }
      if (context.testExpression("author", targetDepth)) {
        context.nextToken();
        application.setAuthor(context.getUnmarshaller(String.class).unmarshall(context));
      }
      if (context.testExpression("creationTime", targetDepth)) {
        context.nextToken();
        application.setCreationTime(context.getUnmarshaller(String.class).unmarshall(context));
      }
      if (context.testExpression("description", targetDepth)) {
        context.nextToken();
        application.setDescription(context.getUnmarshaller(String.class).unmarshall(context));
      }
      if (context.testExpression("homePageUrl", targetDepth)) {
        context.nextToken();
        application.setHomePageUrl(context.getUnmarshaller(String.class).unmarshall(context));
      }
    } else if (token == END_ARRAY || token == END_OBJECT) {
      if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
        if (context.getCurrentDepth() <= originalDepth)
          break;
      }
    }
    token = context.nextToken();
  }

  return application;
}
 
Example 10
Source File: ApplicationSummaryJsonUnmarshaller.java    From realworld-serverless-application with Apache License 2.0 4 votes vote down vote up
public ApplicationSummary unmarshall(JsonUnmarshallerContext context) throws Exception {
  ApplicationSummary applicationSummary = new ApplicationSummary();

  int originalDepth = context.getCurrentDepth();
  String currentParentElement = context.getCurrentParentElement();
  int targetDepth = originalDepth + 1;

  JsonToken token = context.getCurrentToken();
  if (token == null)
    token = context.nextToken();
  if (token == VALUE_NULL) {
    return null;
  }

  while (true) {
    if (token == null)
      break;

    if (token == FIELD_NAME || token == START_OBJECT) {
      if (context.testExpression("applicationId", targetDepth)) {
        context.nextToken();
        applicationSummary.setApplicationId(context.getUnmarshaller(String.class).unmarshall(context));
      }
      if (context.testExpression("creationTime", targetDepth)) {
        context.nextToken();
        applicationSummary.setCreationTime(context.getUnmarshaller(String.class).unmarshall(context));
      }
      if (context.testExpression("description", targetDepth)) {
        context.nextToken();
        applicationSummary.setDescription(context.getUnmarshaller(String.class).unmarshall(context));
      }
    } else if (token == END_ARRAY || token == END_OBJECT) {
      if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
        if (context.getCurrentDepth() <= originalDepth)
          break;
      }
    }
    token = context.nextToken();
  }

  return applicationSummary;
}
 
Example 11
Source File: CreateApplicationInputJsonUnmarshaller.java    From realworld-serverless-application with Apache License 2.0 4 votes vote down vote up
public CreateApplicationInput unmarshall(JsonUnmarshallerContext context) throws Exception {
  CreateApplicationInput createApplicationInput = new CreateApplicationInput();

  int originalDepth = context.getCurrentDepth();
  String currentParentElement = context.getCurrentParentElement();
  int targetDepth = originalDepth + 1;

  JsonToken token = context.getCurrentToken();
  if (token == null)
    token = context.nextToken();
  if (token == VALUE_NULL) {
    return null;
  }

  while (true) {
    if (token == null)
      break;

    if (token == FIELD_NAME || token == START_OBJECT) {
      if (context.testExpression("applicationId", targetDepth)) {
        context.nextToken();
        createApplicationInput.setApplicationId(context.getUnmarshaller(String.class).unmarshall(context));
      }
      if (context.testExpression("author", targetDepth)) {
        context.nextToken();
        createApplicationInput.setAuthor(context.getUnmarshaller(String.class).unmarshall(context));
      }
      if (context.testExpression("description", targetDepth)) {
        context.nextToken();
        createApplicationInput.setDescription(context.getUnmarshaller(String.class).unmarshall(context));
      }
      if (context.testExpression("homePageUrl", targetDepth)) {
        context.nextToken();
        createApplicationInput.setHomePageUrl(context.getUnmarshaller(String.class).unmarshall(context));
      }
    } else if (token == END_ARRAY || token == END_OBJECT) {
      if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
        if (context.getCurrentDepth() <= originalDepth)
          break;
      }
    }
    token = context.nextToken();
  }

  return createApplicationInput;
}
 
Example 12
Source File: UpdateApplicationInputJsonUnmarshaller.java    From realworld-serverless-application with Apache License 2.0 4 votes vote down vote up
public UpdateApplicationInput unmarshall(JsonUnmarshallerContext context) throws Exception {
  UpdateApplicationInput updateApplicationInput = new UpdateApplicationInput();

  int originalDepth = context.getCurrentDepth();
  String currentParentElement = context.getCurrentParentElement();
  int targetDepth = originalDepth + 1;

  JsonToken token = context.getCurrentToken();
  if (token == null)
    token = context.nextToken();
  if (token == VALUE_NULL) {
    return null;
  }

  while (true) {
    if (token == null)
      break;

    if (token == FIELD_NAME || token == START_OBJECT) {
      if (context.testExpression("author", targetDepth)) {
        context.nextToken();
        updateApplicationInput.setAuthor(context.getUnmarshaller(String.class).unmarshall(context));
      }
      if (context.testExpression("description", targetDepth)) {
        context.nextToken();
        updateApplicationInput.setDescription(context.getUnmarshaller(String.class).unmarshall(context));
      }
      if (context.testExpression("homePageUrl", targetDepth)) {
        context.nextToken();
        updateApplicationInput.setHomePageUrl(context.getUnmarshaller(String.class).unmarshall(context));
      }
    } else if (token == END_ARRAY || token == END_OBJECT) {
      if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
        if (context.getCurrentDepth() <= originalDepth)
          break;
      }
    }
    token = context.nextToken();
  }

  return updateApplicationInput;
}
 
Example 13
Source File: LexiconJsonUnmarshaller.java    From ivona-speechcloud-sdk-java with Apache License 2.0 4 votes vote down vote up
public Lexicon unmarshall(JsonUnmarshallerContext context) throws Exception {
    Lexicon lexicon = new Lexicon();

    int originalDepth = context.getCurrentDepth();
    String currentParentElement = context.getCurrentParentElement();
    int targetDepth = originalDepth + 1;

    JsonToken token = context.getCurrentToken();
    if (token == null) {
        token = context.nextToken();
    }
    if (token == VALUE_NULL) {
        return null;
    }

    while (true) {
        if (token == null) {
            break;
        }

        if (token == FIELD_NAME || token == START_OBJECT) {
            if (context.testExpression(JSON_KEY_NAME, targetDepth)) {
                context.nextToken();
                lexicon.setName(
                        SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller.getInstance().unmarshall(context));
            }
            if (context.testExpression(JSON_KEY_CONTENTS, targetDepth)) {
                context.nextToken();
                lexicon.setContents(
                        SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller.getInstance().unmarshall(context));
            }
        } else if (token == END_ARRAY || token == END_OBJECT) {
            if (context.getLastParsedParentElement() == null
                    || context.getLastParsedParentElement().equals(currentParentElement)) {
                if (context.getCurrentDepth() <= originalDepth) {
                    break;
                }
            }
        }

        token = context.nextToken();
    }

    return lexicon;
}
 
Example 14
Source File: VoiceJsonUnmarshaller.java    From ivona-speechcloud-sdk-java with Apache License 2.0 4 votes vote down vote up
public Voice unmarshall(JsonUnmarshallerContext context) throws Exception {

        Voice voice = new Voice();

        int originalDepth = context.getCurrentDepth();
        String currentParentElement = context.getCurrentParentElement();
        int targetDepth = originalDepth + 1;

        JsonToken token = context.getCurrentToken();
        if (token == null) {
            token = context.nextToken();
        }
        if (token == VALUE_NULL) {
            return null;
        }

        while (true) {
            if (token == null) {
                break;
            }

            if (token == FIELD_NAME || token == START_OBJECT) {
                if (context.testExpression(JSON_KEY_NAME, targetDepth)) {
                    context.nextToken();
                    voice.setName(
                            SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller.getInstance().unmarshall(context));
                }
                if (context.testExpression(JSON_KEY_LANGUAGE, targetDepth)) {
                    context.nextToken();
                    voice.setLanguage(
                            SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller.getInstance().unmarshall(context));
                }
                if (context.testExpression(JSON_KEY_GENDER, targetDepth)) {
                    context.nextToken();
                    voice.setGender(
                            SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller.getInstance().unmarshall(context));
                }
            } else if (token == END_ARRAY || token == END_OBJECT) {
                if (context.getLastParsedParentElement() == null
                        || context.getLastParsedParentElement().equals(currentParentElement)) {
                    if (context.getCurrentDepth() <= originalDepth) {
                        break;
                    }
                }
            }

            token = context.nextToken();
        }

        return voice;
    }