public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { ListJobsResponse response = new ListJobsResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("JobList", targetDepth)) { var unmarshaller = new ListUnmarshaller <GlacierJobDescription, GlacierJobDescriptionUnmarshaller>( GlacierJobDescriptionUnmarshaller.GetInstance()); response.JobList = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Marker", targetDepth)) { response.Marker = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } return(response); }
public static GlacierJobDescriptionUnmarshaller GetInstance() { if (instance == null) { instance = new GlacierJobDescriptionUnmarshaller(); } return(instance); }
public ListJobsResult Unmarshall(JsonUnmarshallerContext context) { ListJobsResult listJobsResult = new ListJobsResult(); listJobsResult.JobList = null; int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if ((context.IsKey) && (context.CurrentDepth == targetDepth)) { context.Read(); context.Read(); if (context.TestExpression("JobList", targetDepth)) { listJobsResult.JobList = new List <GlacierJobDescription>(); GlacierJobDescriptionUnmarshaller unmarshaller = GlacierJobDescriptionUnmarshaller.GetInstance(); while (context.Read()) { if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth)) { listJobsResult.JobList.Add(unmarshaller.Unmarshall(context)); } else if (context.IsEndArray) { break; } } continue; } if (context.TestExpression("Marker", targetDepth)) { listJobsResult.Marker = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth <= originalDepth) { return(listJobsResult); } } return(listJobsResult); }
private static void UnmarshallResult(JsonUnmarshallerContext context, ListJobsResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.TestExpression("JobList", targetDepth)) { context.Read(); if (context.CurrentTokenType == JsonToken.Null) { response.JobList = null; continue; } response.JobList = new List <GlacierJobDescription>(); GlacierJobDescriptionUnmarshaller unmarshaller = GlacierJobDescriptionUnmarshaller.GetInstance(); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart) { continue; } if (token == JsonToken.ArrayEnd) { break; } response.JobList.Add(unmarshaller.Unmarshall(context)); } continue; } if (context.TestExpression("Marker", targetDepth)) { context.Read(); response.Marker = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.CurrentDepth <= originalDepth) { return; } } return; }