/aws-java-sdk-location/src/main/java/com/amazonaws/services/location/model/transform/CalculateRouteCarModeOptionsJsonUnmarshaller.java

https://github.com/aws/aws-sdk-java · Java · 78 lines · 50 code · 13 blank · 15 comment · 24 complexity · 26f6298760d9c42eebb13c4669ffc9c6 MD5 · raw file

  1. /*
  2. * Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
  5. * the License. A copy of the License is located at
  6. *
  7. * http://aws.amazon.com/apache2.0
  8. *
  9. * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  10. * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
  11. * and limitations under the License.
  12. */
  13. package com.amazonaws.services.location.model.transform;
  14. import java.math.*;
  15. import javax.annotation.Generated;
  16. import com.amazonaws.services.location.model.*;
  17. import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
  18. import com.amazonaws.transform.*;
  19. import com.fasterxml.jackson.core.JsonToken;
  20. import static com.fasterxml.jackson.core.JsonToken.*;
  21. /**
  22. * CalculateRouteCarModeOptions JSON Unmarshaller
  23. */
  24. @Generated("com.amazonaws:aws-java-sdk-code-generator")
  25. public class CalculateRouteCarModeOptionsJsonUnmarshaller implements Unmarshaller<CalculateRouteCarModeOptions, JsonUnmarshallerContext> {
  26. public CalculateRouteCarModeOptions unmarshall(JsonUnmarshallerContext context) throws Exception {
  27. CalculateRouteCarModeOptions calculateRouteCarModeOptions = new CalculateRouteCarModeOptions();
  28. int originalDepth = context.getCurrentDepth();
  29. String currentParentElement = context.getCurrentParentElement();
  30. int targetDepth = originalDepth + 1;
  31. JsonToken token = context.getCurrentToken();
  32. if (token == null)
  33. token = context.nextToken();
  34. if (token == VALUE_NULL) {
  35. return null;
  36. }
  37. while (true) {
  38. if (token == null)
  39. break;
  40. if (token == FIELD_NAME || token == START_OBJECT) {
  41. if (context.testExpression("AvoidFerries", targetDepth)) {
  42. context.nextToken();
  43. calculateRouteCarModeOptions.setAvoidFerries(context.getUnmarshaller(Boolean.class).unmarshall(context));
  44. }
  45. if (context.testExpression("AvoidTolls", targetDepth)) {
  46. context.nextToken();
  47. calculateRouteCarModeOptions.setAvoidTolls(context.getUnmarshaller(Boolean.class).unmarshall(context));
  48. }
  49. } else if (token == END_ARRAY || token == END_OBJECT) {
  50. if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
  51. if (context.getCurrentDepth() <= originalDepth)
  52. break;
  53. }
  54. }
  55. token = context.nextToken();
  56. }
  57. return calculateRouteCarModeOptions;
  58. }
  59. private static CalculateRouteCarModeOptionsJsonUnmarshaller instance;
  60. public static CalculateRouteCarModeOptionsJsonUnmarshaller getInstance() {
  61. if (instance == null)
  62. instance = new CalculateRouteCarModeOptionsJsonUnmarshaller();
  63. return instance;
  64. }
  65. }