public Ui5Value(Ui5Value source)
 {
     description = source.description;
     if (source.type != null)
     {
         type = source.type;
     }
 }
Пример #2
0
        public override string SerializeTypescript()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine($"class {name} {(extends != null ? "extends " + Ui5Value.GetRelativeTypeDef(this, extends) : "")}{"{"}");

            AppendProperties(sb, true, true);

            sb.AppendLine("}");
            return(sb.ToString());
        }
Пример #3
0
        override public string SerializeTypescript()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine($"class {name} {(extends != null ? "extends " + Ui5Value.GetRelativeTypeDef(this, extends) : "")} {"{"}");

            string metadata = null;

            //if (ui5Metadata != null)
            //    metadata = CreateMetaDataStrings();

            if (constructor.visibility == Visibility.Public && constructor.IncludedInVersion())
            {
                sb.AppendLine(constructor.SerializeTypescriptMethodStubs().Aggregate((a, b) => a + ";" + Environment.NewLine + b) + ";", 1);
                // Create overload with any (to be extendable and get all intellisense experience.
                if (ui5Metadata != null)
                {
                    var msettings = constructor.parameters.FirstOrDefault(x => x.name == "mSettings");
                    if (msettings != null)
                    {
                        msettings.type           = "any";
                        constructor.description += Environment.NewLine + "@note Any overloads to support not documented metadata";
                        sb.AppendLine(constructor.SerializeTypescriptMethodStubs().Aggregate((a, b) => a + ";" + Environment.NewLine + b) + ";", 1);
                    }
                }
            }

            AppendProperties(sb);

            AppendMethods(sb);

            sb.AppendLine("}");

            //if(metadata != null)
            //    sb.AppendLine(metadata, 1);

            return(sb.ToString());
        }
        public virtual string SerializeTypescript(bool @explicit = false, bool createstatic = false, bool alloptional = false, bool?alwayspublic = null, bool skipprotected = false)
        {
            StringBuilder sb = new StringBuilder();

            if (alwayspublic == null)
            {
                alwayspublic = Properties.Settings.Default.SuppressVisibility;
            }
            string safeproptype = Ui5Value.GetRelativeTypeDef(owner, propertytype);

            if (description != null)
            {
                sb.AppendComment(description + (defaultValue != null? Environment.NewLine + "@default " + defaultValue : ""));
            }
            // set visibility comment out if visibility is private
            sb.Append((globalValues.HideMember(visibility) ? "// " + visibility.ToString() + " " : globalValues.ShowVisibility(visibility)));
            sb.Append(@explicit ? (@static && createstatic ? "static " : "var ") : "");
            sb.Append(base.name);
            sb.Append((alloptional ? "?" : "") + ": ");
            sb.Append(safeproptype);
            sb.AppendLine(CreateDefaultValueSafely(safeproptype) + ";");
            return(sb.ToString());
        }