/// <summary> /// Create the template output /// </summary> public virtual string TransformText() { #line 7 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" if (this.Root != null) { switch (this.Root.NodeType) { case Migration.Model.NodeType.Class: { var classNode = this.Root as ClassNode; if (classNode != null) { #line default #line hidden #line 18 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" if (!string.IsNullOrEmpty(classNode.Summary)) { #line default #line hidden this.Write("\r\n/**\r\n * @Description: "); #line 24 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(classNode.Summary)); #line default #line hidden this.Write("\r\n*/\r\n"); #line 26 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" } #line default #line hidden #line 29 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TemplateUtility.GetIndent(this.Indent))); #line default #line hidden this.Write("class "); #line 29 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(classNode.Name)); #line default #line hidden #line 29 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(string.IsNullOrEmpty(classNode.BaseTypeName)?string.Empty : string.Concat(" extends ", classNode.BaseTypeName))); #line default #line hidden this.Write(" {\r\n\r\n"); #line 31 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" if (classNode.Items != null && classNode.Items.Count > 0) { var propertyNodes = classNode.Items.Where(v => v.NodeType == NodeType.Property && v.IsChecked).ToList(); if (propertyNodes.Count > 0) { #line default #line hidden #line 38 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TemplateUtility.GetIndent(this.Indent + 1))); #line default #line hidden this.Write("// region Properties\r\n\r\n"); #line 40 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" foreach (var propertyNode in propertyNodes) { var javaTemplate = new JavaTemplate(); javaTemplate.Root = propertyNode; javaTemplate.Indent = 1; var content = javaTemplate.TransformText(); #line default #line hidden #line 47 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(content)); #line default #line hidden #line 47 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" } #line default #line hidden #line 50 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TemplateUtility.GetIndent(this.Indent + 1))); #line default #line hidden this.Write("// endregion\r\n\r\n"); #line 52 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" } var fieldNodes = classNode.Items.Where(v => v.NodeType == NodeType.Field && v.IsChecked).ToList(); if (fieldNodes.Count > 0) { #line default #line hidden #line 59 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TemplateUtility.GetIndent(this.Indent + 1))); #line default #line hidden this.Write("// region Fields\r\n"); #line 60 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" foreach (var fieldNode in fieldNodes) { var javaTemplate = new JavaTemplate(); javaTemplate.Root = fieldNode; javaTemplate.Indent = 1; var content = javaTemplate.TransformText(); #line default #line hidden #line 67 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(content)); #line default #line hidden #line 67 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" } #line default #line hidden #line 71 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TemplateUtility.GetIndent(this.Indent + 1))); #line default #line hidden this.Write("// endregion\r\n\r\n"); #line 73 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" } var methodNodes = classNode.Items.Where(v => v.NodeType == NodeType.Method && v.IsChecked).ToList(); if (methodNodes.Count > 0) { #line default #line hidden #line 80 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TemplateUtility.GetIndent(this.Indent + 1))); #line default #line hidden this.Write("// region Methods\r\n"); #line 81 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" foreach (var methodNode in methodNodes) { var javaTemplate = new JavaTemplate(); javaTemplate.Root = methodNode; javaTemplate.Indent = 1; var content = javaTemplate.TransformText(); #line default #line hidden #line 88 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(content)); #line default #line hidden #line 88 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" } #line default #line hidden #line 91 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TemplateUtility.GetIndent(this.Indent + 1))); #line default #line hidden this.Write("// endregion\r\n\r\n"); #line 93 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" } } #line default #line hidden this.Write("}\r\n"); #line 98 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" } } break; case Migration.Model.NodeType.Enum: #line default #line hidden this.Write("enum "); #line 104 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Root.Name)); #line default #line hidden #line 104 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" break; case Migration.Model.NodeType.Property: { var propertyNode = this.Root as PropertyNode; if (propertyNode != null) { #line default #line hidden #line 112 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TemplateUtility.GetIndent(this.Indent))); #line default #line hidden this.Write("private "); #line 112 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(propertyNode.JavaTypeName ?? string.Empty)); #line default #line hidden this.Write(" "); #line 112 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(propertyNode.PropertyJavaName)); #line default #line hidden this.Write(";"); #line 112 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(string.IsNullOrEmpty(propertyNode.Summary) ? string.Empty : string.Concat("// ", propertyNode.Summary))); #line default #line hidden this.Write("\r\n\r\n"); #line 114 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" if (propertyNode != null && propertyNode.Items.Count > 0) { var items = this.Root.Items.Where(v => v.IsChecked).ToList(); foreach (var item in items) { var javaTemplate = new JavaTemplate(); javaTemplate.Root = item; javaTemplate.Indent = this.Indent; var content = javaTemplate.TransformText(); #line default #line hidden #line 124 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(content)); #line default #line hidden #line 124 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" } } } } break; case Migration.Model.NodeType.Field: { var fieldNode = this.Root as FieldNode; if (fieldNode != null) { #line default #line hidden #line 137 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TemplateUtility.GetIndent(this.Indent))); #line default #line hidden #line 137 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(fieldNode.JavaTypeName)); #line default #line hidden this.Write(" "); #line 137 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(fieldNode.Name)); #line default #line hidden #line 137 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(string.IsNullOrEmpty(fieldNode.ConstValue) ? string.Empty : string.Concat(" = ", fieldNode.ConstValue))); #line default #line hidden this.Write(";"); #line 137 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(string.IsNullOrEmpty(fieldNode.Summary) ? string.Empty : string.Concat("// ", fieldNode.Summary))); #line default #line hidden this.Write("\r\n"); #line 138 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" } } break; case Migration.Model.NodeType.Method: { var methodNode = this.Root as MethodNode; if (methodNode != null) { if (methodNode.IsGet) { #line default #line hidden #line 151 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TemplateUtility.GetIndent(this.Indent))); #line default #line hidden this.Write("public "); #line 151 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(methodNode.ReturnJavaTypeName ?? string.Empty)); #line default #line hidden this.Write(" get"); #line 151 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(methodNode.PropertyName)); #line default #line hidden this.Write("() {\r\n"); #line 152 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TemplateUtility.GetIndent(this.Indent + 1))); #line default #line hidden this.Write("return "); #line 152 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(methodNode.PropertyJavaName)); #line default #line hidden this.Write(";\r\n"); #line 153 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TemplateUtility.GetIndent(this.Indent))); #line default #line hidden this.Write("}\r\n\r\n"); #line 155 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" } else if (methodNode.IsSet) { #line default #line hidden #line 160 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TemplateUtility.GetIndent(this.Indent))); #line default #line hidden this.Write("public void set"); #line 160 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(methodNode.PropertyName)); #line default #line hidden this.Write("("); #line 160 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture((methodNode.Parameters != null && methodNode.Parameters.Count > 0)?string.Join(", ", methodNode.Parameters.Select(v => string.Format("{0} {1}", v.JavaTypeName, v.Name))):string.Empty)); #line default #line hidden this.Write("){\r\n"); #line 161 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TemplateUtility.GetIndent(this.Indent + 1))); #line default #line hidden #line 161 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(methodNode.PropertyJavaName)); #line default #line hidden this.Write(" = value;\r\n"); #line 162 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TemplateUtility.GetIndent(this.Indent))); #line default #line hidden this.Write("}\r\n\r\n"); #line 164 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" } else { if (!string.IsNullOrEmpty(methodNode.Summary)) { #line default #line hidden this.Write("\r\n"); #line 172 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TemplateUtility.GetIndent(this.Indent))); #line default #line hidden this.Write("/**\r\n"); #line 173 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TemplateUtility.GetIndent(this.Indent))); #line default #line hidden this.Write(" * "); #line 173 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(methodNode.Summary)); #line default #line hidden this.Write("\r\n"); #line 174 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TemplateUtility.GetIndent(this.Indent))); #line default #line hidden this.Write("*/\r\n"); #line 175 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" } #line default #line hidden #line 178 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(TemplateUtility.GetIndent(this.Indent))); #line default #line hidden this.Write("public "); #line 178 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(methodNode.IsStatic?"static ":string.Empty)); #line default #line hidden #line 178 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(methodNode.ReturnJavaTypeName ?? string.Empty)); #line default #line hidden this.Write(" "); #line 178 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(methodNode.Name)); #line default #line hidden this.Write("("); #line 178 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture((methodNode.Parameters != null && methodNode.Parameters.Count > 0)?string.Join(", ", methodNode.Parameters.Select(v => string.Format("{0} {1}", v.JavaTypeName, v.Name))):string.Empty)); #line default #line hidden this.Write(");\r\n\r\n"); #line 180 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" } } } break; case Migration.Model.NodeType.Namespace: { #line default #line hidden this.Write("package "); #line 189 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Root.Name ?? string.Empty)); #line default #line hidden this.Write(";\r\n"); #line 190 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" if (this.Root.Items != null && this.Root.Items.Count > 0) { var items = this.Root.Items.Where(v => v.IsChecked).ToList(); foreach (var item in items) { var javaTemplate = new JavaTemplate(); javaTemplate.Root = item; var content = javaTemplate.TransformText(); #line default #line hidden #line 199 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(content)); #line default #line hidden #line 199 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" } } } break; case Migration.Model.NodeType.Root: { if (this.Root.Items != null && this.Root.Items.Count > 0) { var items = this.Root.Items.Where(v => v.IsChecked).ToList(); foreach (var item in items) { var javaTemplate = new JavaTemplate(); javaTemplate.Root = item; var content = javaTemplate.TransformText(); #line default #line hidden #line 215 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(content)); #line default #line hidden #line 215 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" } } } break; case Migration.Model.NodeType.None: default: #line default #line hidden this.Write("notsupport "); #line 223 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" this.Write(this.ToStringHelper.ToStringWithCulture(this.Root.Name)); #line default #line hidden #line 223 "D:\HarrisGitlab\harriszhang\Migration\Migration\Core\Template\Java\JavaTemplate.tt" break; } } #line default #line hidden return(this.GenerationEnvironment.ToString()); }