public ActivityTask unmarshall(JsonUnmarshallerContext context) throws Exception {
    ActivityTask activityTask = new ActivityTask();

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

    JsonToken token = context.currentToken;
    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("taskToken", targetDepth)) {
          context.nextToken();
          activityTask.setTaskToken(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("activityId", targetDepth)) {
          context.nextToken();
          activityTask.setActivityId(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("startedEventId", targetDepth)) {
          context.nextToken();
          activityTask.setStartedEventId(LongJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("workflowExecution", targetDepth)) {
          context.nextToken();
          activityTask.setWorkflowExecution(
              WorkflowExecutionJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("activityType", targetDepth)) {
          context.nextToken();
          activityTask.setActivityType(
              ActivityTypeJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("input", targetDepth)) {
          context.nextToken();
          activityTask.setInput(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 activityTask;
  }
  public ScheduleActivityTaskFailedEventAttributes unmarshall(JsonUnmarshallerContext context)
      throws Exception {
    ScheduleActivityTaskFailedEventAttributes scheduleActivityTaskFailedEventAttributes =
        new ScheduleActivityTaskFailedEventAttributes();

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

    JsonToken token = context.currentToken;
    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("activityType", targetDepth)) {
          context.nextToken();
          scheduleActivityTaskFailedEventAttributes.setActivityType(
              ActivityTypeJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("activityId", targetDepth)) {
          context.nextToken();
          scheduleActivityTaskFailedEventAttributes.setActivityId(
              StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("cause", targetDepth)) {
          context.nextToken();
          scheduleActivityTaskFailedEventAttributes.setCause(
              StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("decisionTaskCompletedEventId", targetDepth)) {
          context.nextToken();
          scheduleActivityTaskFailedEventAttributes.setDecisionTaskCompletedEventId(
              LongJsonUnmarshaller.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 scheduleActivityTaskFailedEventAttributes;
  }