public DecisionTask unmarshall(JsonUnmarshallerContext context) throws Exception { DecisionTask decisionTask = new DecisionTask(); 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(); decisionTask.setTaskToken(StringJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("startedEventId", targetDepth)) { context.nextToken(); decisionTask.setStartedEventId(LongJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("workflowExecution", targetDepth)) { context.nextToken(); decisionTask.setWorkflowExecution( WorkflowExecutionJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("workflowType", targetDepth)) { context.nextToken(); decisionTask.setWorkflowType( WorkflowTypeJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("events", targetDepth)) { decisionTask.setEvents( new ListUnmarshaller<HistoryEvent>(HistoryEventJsonUnmarshaller.getInstance()) .unmarshall(context)); } if (context.testExpression("nextPageToken", targetDepth)) { context.nextToken(); decisionTask.setNextPageToken(StringJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("previousStartedEventId", targetDepth)) { context.nextToken(); decisionTask.setPreviousStartedEventId( 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 decisionTask; }
public ChildWorkflowExecutionFailedEventAttributes unmarshall(JsonUnmarshallerContext context) throws Exception { ChildWorkflowExecutionFailedEventAttributes childWorkflowExecutionFailedEventAttributes = new ChildWorkflowExecutionFailedEventAttributes(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; JsonToken token = context.currentToken; if (token == null) token = context.nextToken(); while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("workflowExecution", targetDepth)) { context.nextToken(); childWorkflowExecutionFailedEventAttributes.setWorkflowExecution( WorkflowExecutionJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("workflowType", targetDepth)) { context.nextToken(); childWorkflowExecutionFailedEventAttributes.setWorkflowType( WorkflowTypeJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("reason", targetDepth)) { context.nextToken(); childWorkflowExecutionFailedEventAttributes.setReason( StringJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("details", targetDepth)) { context.nextToken(); childWorkflowExecutionFailedEventAttributes.setDetails( StringJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("initiatedEventId", targetDepth)) { context.nextToken(); childWorkflowExecutionFailedEventAttributes.setInitiatedEventId( LongJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("startedEventId", targetDepth)) { context.nextToken(); childWorkflowExecutionFailedEventAttributes.setStartedEventId( LongJsonUnmarshaller.getInstance().unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getCurrentDepth() <= originalDepth) break; } token = context.nextToken(); } return childWorkflowExecutionFailedEventAttributes; }