Пример #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void formatPreamble(Appendable builder) throws java.io.IOException
        private void FormatPreamble(Appendable builder)
        {
            string interfaceSimpleName = _interfaceClass.Name;
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getCanonicalName method:
            string interfaceClassName = interfaceSimpleName.Length == 0 ? _interfaceClass.FullName : interfaceSimpleName;

            if (_generatedClassPackage.Length > 0)
            {
                Formatln(builder, "package %s;", _generatedClassPackage);
                Formatln(builder);
            }
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getCanonicalName method:
            Formatln(builder, "import %s;", typeof(Visitable).FullName);
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getCanonicalName method:
            Formatln(builder, "import %s;", _interfaceClass.FullName);
            Formatln(builder);
            foreach (string importExpr in _argumentFormatter.imports())
            {
                Formatln(builder, "import %s;", importExpr);
            }
            Formatln(builder);
            Formatln(builder, "//");
            Formatln(builder, "// GENERATED FILE. DO NOT EDIT.");
            Formatln(builder, "//");
            Formatln(builder, "// This has been generated by:");
            Formatln(builder, "//");
            if (_generatorInfo.Length > 0)
            {
                Formatln(builder, "//   %s", _generatorInfo);
                Formatln(builder, "//");
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getCanonicalName method:
                Formatln(builder, "// (using %s)", this.GetType().FullName);
                Formatln(builder, "//");
            }
            else
            {
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getCanonicalName method:
                Formatln(builder, "//   %s", this.GetType().FullName);
                Formatln(builder, "//");
            }
            Formatln(builder);
            Formatln(builder, "public enum %s", _generatedClassName);
            Formatln(builder, "implements %s<%s>", typeof(Visitable).Name, interfaceClassName);
            Formatln(builder, "{");
            Formatln(builder, "    INSTANCE;");
            Formatln(builder);
            Formatln(builder, "    public void accept( %s visitor )", interfaceClassName);
            Formatln(builder, "    {");
        }