public static SslConfigurationUnmarshaller GetInstance() { if (instance == null) { instance = new SslConfigurationUnmarshaller(); } return(instance); }
public App Unmarshall(JsonUnmarshallerContext context) { if (context.CurrentTokenType == JsonToken.Null) { return(null); } App app = new App(); int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.TestExpression("AppId", targetDepth)) { context.Read(); app.AppId = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("StackId", targetDepth)) { context.Read(); app.StackId = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Shortname", targetDepth)) { context.Read(); app.Shortname = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Name", targetDepth)) { context.Read(); app.Name = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Description", targetDepth)) { context.Read(); app.Description = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Type", targetDepth)) { context.Read(); app.Type = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("AppSource", targetDepth)) { context.Read(); app.AppSource = SourceUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Domains", targetDepth)) { context.Read(); app.Domains = new List <String>(); StringUnmarshaller unmarshaller = StringUnmarshaller.GetInstance(); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart) { continue; } if (token == JsonToken.ArrayEnd) { break; } app.Domains.Add(unmarshaller.Unmarshall(context)); } continue; } if (context.TestExpression("EnableSsl", targetDepth)) { context.Read(); app.EnableSsl = BoolUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("SslConfiguration", targetDepth)) { context.Read(); app.SslConfiguration = SslConfigurationUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Attributes", targetDepth)) { context.Read(); app.Attributes = new Dictionary <String, String>(); KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance()); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart) { continue; } if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd) { break; } KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context); app.Attributes.Add(kvp.Key, kvp.Value); } continue; } if (context.TestExpression("CreatedAt", targetDepth)) { context.Read(); app.CreatedAt = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.CurrentDepth <= originalDepth) { return(app); } } return(app); }
public App Unmarshall(JsonUnmarshallerContext context) { App app = new App(); app.Domains = null; app.Attributes = 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("AppId", targetDepth)) { app.AppId = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("StackId", targetDepth)) { app.StackId = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Shortname", targetDepth)) { app.Shortname = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Name", targetDepth)) { app.Name = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Description", targetDepth)) { app.Description = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Type", targetDepth)) { app.Type = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("AppSource", targetDepth)) { app.AppSource = SourceUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Domains", targetDepth)) { app.Domains = new List <String>(); StringUnmarshaller unmarshaller = StringUnmarshaller.GetInstance(); while (context.Read()) { if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth)) { app.Domains.Add(unmarshaller.Unmarshall(context)); } else if (context.IsEndArray) { break; } } continue; } if (context.TestExpression("EnableSsl", targetDepth)) { app.EnableSsl = BoolUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("SslConfiguration", targetDepth)) { app.SslConfiguration = SslConfigurationUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Attributes", targetDepth)) { app.Attributes = new Dictionary <String, String>(); KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance()); while (context.Read()) { if (((context.IsStartArray || context.IsStartElement || context.IsLeafValue) && (context.CurrentDepth == targetDepth)) || ((context.IsKey) && (context.CurrentDepth == targetDepth + 1))) { KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context); app.Attributes.Add(kvp.Key, kvp.Value); } else if (context.IsEndElement) { break; } } continue; } if (context.TestExpression("CreatedAt", targetDepth)) { app.CreatedAt = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth <= originalDepth) { return(app); } } return(app); }
public App Unmarshall(JsonUnmarshallerContext context) { context.Read(); if (context.CurrentTokenType == JsonToken.Null) { return(null); } App app = new App(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("AppId", targetDepth)) { app.AppId = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("StackId", targetDepth)) { app.StackId = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Shortname", targetDepth)) { app.Shortname = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Name", targetDepth)) { app.Name = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Description", targetDepth)) { app.Description = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Type", targetDepth)) { app.Type = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("AppSource", targetDepth)) { app.AppSource = SourceUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Domains", targetDepth)) { var unmarshaller = new ListUnmarshaller <String, StringUnmarshaller>( StringUnmarshaller.GetInstance()); app.Domains = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("EnableSsl", targetDepth)) { app.EnableSsl = BoolUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("SslConfiguration", targetDepth)) { app.SslConfiguration = SslConfigurationUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Attributes", targetDepth)) { var unmarshaller = new DictionaryUnmarshaller <String, String, StringUnmarshaller, StringUnmarshaller>( StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance()); app.Attributes = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("CreatedAt", targetDepth)) { app.CreatedAt = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } return(app); }