public GetDocumentResult unmarshall(JsonUnmarshallerContext context) throws Exception { GetDocumentResult getDocumentResult = new GetDocumentResult(); 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("Name", targetDepth)) { context.nextToken(); getDocumentResult.setName(StringJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("Content", targetDepth)) { context.nextToken(); getDocumentResult.setContent(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 getDocumentResult; }
public Command unmarshall(JsonUnmarshallerContext context) throws Exception { Command command = new Command(); 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("CommandId", targetDepth)) { context.nextToken(); command.setCommandId(StringJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("DocumentName", targetDepth)) { context.nextToken(); command.setDocumentName(StringJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("Comment", targetDepth)) { context.nextToken(); command.setComment(StringJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("ExpiresAfter", targetDepth)) { context.nextToken(); command.setExpiresAfter(DateJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("Parameters", targetDepth)) { context.nextToken(); command.setParameters( new MapUnmarshaller<String, java.util.List<String>>( StringJsonUnmarshaller.getInstance(), new ListUnmarshaller<String>(StringJsonUnmarshaller.getInstance())) .unmarshall(context)); } if (context.testExpression("InstanceIds", targetDepth)) { context.nextToken(); command.setInstanceIds( new ListUnmarshaller<String>(StringJsonUnmarshaller.getInstance()) .unmarshall(context)); } if (context.testExpression("RequestedDateTime", targetDepth)) { context.nextToken(); command.setRequestedDateTime(DateJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("Status", targetDepth)) { context.nextToken(); command.setStatus(StringJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("OutputS3BucketName", targetDepth)) { context.nextToken(); command.setOutputS3BucketName(StringJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("OutputS3KeyPrefix", targetDepth)) { context.nextToken(); command.setOutputS3KeyPrefix(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 command; }
public DocumentDescription unmarshall(JsonUnmarshallerContext context) throws Exception { DocumentDescription documentDescription = new DocumentDescription(); 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("Sha1", targetDepth)) { context.nextToken(); documentDescription.setSha1(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("Hash", targetDepth)) { context.nextToken(); documentDescription.setHash(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("HashType", targetDepth)) { context.nextToken(); documentDescription.setHashType( context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("Name", targetDepth)) { context.nextToken(); documentDescription.setName(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("Owner", targetDepth)) { context.nextToken(); documentDescription.setOwner(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("CreatedDate", targetDepth)) { context.nextToken(); documentDescription.setCreatedDate( context.getUnmarshaller(java.util.Date.class).unmarshall(context)); } if (context.testExpression("Status", targetDepth)) { context.nextToken(); documentDescription.setStatus(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("Description", targetDepth)) { context.nextToken(); documentDescription.setDescription( context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("Parameters", targetDepth)) { context.nextToken(); documentDescription.setParameters( new ListUnmarshaller<DocumentParameter>( DocumentParameterJsonUnmarshaller.getInstance()) .unmarshall(context)); } if (context.testExpression("PlatformTypes", targetDepth)) { context.nextToken(); documentDescription.setPlatformTypes( new ListUnmarshaller<String>(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 documentDescription; }