public static ButlerClass Create(string className, string path, JToken jToken)
        {
            ButlerClass bClass = new ButlerClass(className, path);

            bClass.SetAccessibility(ButlerAccessibility.Public);

            foreach (JToken childToken in jToken.Children())
            {
                ButlerProperty bProperty = ButlerPropertyFactory.Create(childToken);
                bProperty.SetAccessibility(ButlerAccessibility.Public);
                bProperty.AddAccessor(ButlerAccessorType.Get, ButlerAccessibility.Public);
                bProperty.AddAccessor(ButlerAccessorType.Set, ButlerAccessibility.Private);
                bProperty.AddAttribute("JsonProperty", $"\"{bProperty.Id}\"");

                bClass.AddProperty(bProperty);
            }

            ButlerConstructor bConstructor = ButlerConstructorFactory.Create(bClass);

            bConstructor.AddPropertyParameterRange(bClass.Properties);
            bConstructor.AddAttribute("JsonConstructor");

            bClass.AddConstructor(bConstructor);

            return(bClass);
        }
Exemple #2
0
 private void AddDependency(ButlerClass bClass)
 {
     Dependencies.Add(bClass);
 }