public Step Unmarshall(JsonUnmarshallerContext context) { if (context.CurrentTokenType == JsonToken.Null) { return(null); } Step step = new Step(); int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.TestExpression("Id", targetDepth)) { context.Read(); step.Id = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Name", targetDepth)) { context.Read(); step.Name = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Config", targetDepth)) { context.Read(); step.Config = HadoopStepConfigUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ActionOnFailure", targetDepth)) { context.Read(); step.ActionOnFailure = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Status", targetDepth)) { context.Read(); step.Status = StepStatusUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.CurrentDepth <= originalDepth) { return(step); } } return(step); }
public StepSummary Unmarshall(JsonUnmarshallerContext context) { context.Read(); if (context.CurrentTokenType == JsonToken.Null) { return(null); } StepSummary stepSummary = new StepSummary(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("Id", targetDepth)) { stepSummary.Id = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Name", targetDepth)) { stepSummary.Name = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Status", targetDepth)) { stepSummary.Status = StepStatusUnmarshaller.GetInstance().Unmarshall(context); continue; } } return(stepSummary); }
public static StepStatusUnmarshaller GetInstance() { if (instance == null) { instance = new StepStatusUnmarshaller(); } return(instance); }