public static JobInputUnmarshaller GetInstance() { if (instance == null) { instance = new JobInputUnmarshaller(); } return(instance); }
public Job Unmarshall(JsonUnmarshallerContext context) { context.Read(); if (context.CurrentTokenType == JsonToken.Null) { return(null); } Job job = new Job(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("Id", targetDepth)) { job.Id = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Arn", targetDepth)) { job.Arn = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("PipelineId", targetDepth)) { job.PipelineId = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Input", targetDepth)) { job.Input = JobInputUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Output", targetDepth)) { job.Output = JobOutputUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Outputs", targetDepth)) { var unmarshaller = new ListUnmarshaller <JobOutput, JobOutputUnmarshaller>( JobOutputUnmarshaller.GetInstance()); job.Outputs = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("OutputKeyPrefix", targetDepth)) { job.OutputKeyPrefix = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Playlists", targetDepth)) { var unmarshaller = new ListUnmarshaller <Playlist, PlaylistUnmarshaller>( PlaylistUnmarshaller.GetInstance()); job.Playlists = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Status", targetDepth)) { job.Status = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } return(job); }
public Job Unmarshall(JsonUnmarshallerContext context) { if (context.CurrentTokenType == JsonUnmarshallerContext.TokenType.Null) { return(null); } Job job = new Job(); job.Outputs = null; job.Playlists = 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("Id", targetDepth)) { job.Id = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("PipelineId", targetDepth)) { job.PipelineId = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Input", targetDepth)) { job.Input = JobInputUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Output", targetDepth)) { job.Output = JobOutputUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Outputs", targetDepth)) { job.Outputs = new List <JobOutput>(); JobOutputUnmarshaller unmarshaller = JobOutputUnmarshaller.GetInstance(); while (context.Read()) { if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth)) { job.Outputs.Add(unmarshaller.Unmarshall(context)); } else if (context.IsEndArray) { break; } } continue; } if (context.TestExpression("OutputKeyPrefix", targetDepth)) { job.OutputKeyPrefix = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Playlists", targetDepth)) { job.Playlists = new List <Playlist>(); PlaylistUnmarshaller unmarshaller = PlaylistUnmarshaller.GetInstance(); while (context.Read()) { if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth)) { job.Playlists.Add(unmarshaller.Unmarshall(context)); } else if (context.IsEndArray) { break; } } continue; } if (context.TestExpression("Status", targetDepth)) { job.Status = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth <= originalDepth) { return(job); } } return(job); }