示例#1
0
        public override void EnterEnumDeclaration(JavaParser.EnumDeclarationContext context)
        {
            string name = context.IDENTIFIER().GetText();

            ClassName enumName = new ClassName(
                new FileName(parentFilePath),
                new PackageName(packageFqn),
                name);

            EnumInfo = new ClassInfo(
                enumName,
                new List <MethodInfo>(),
                new List <FieldInfo>(),
                modifier,
                new List <ClassInfo>(),
                new SourceCodeSnippet("", SourceCodeLanguage.Java),
                false);

            if (context.enumBodyDeclarations() != null)
            {
                EnumBodyDeclarationsListener enumBodyDeclarationsListener =
                    new EnumBodyDeclarationsListener(EnumInfo);
                context.enumBodyDeclarations().EnterRule(enumBodyDeclarationsListener);
            }
        }
示例#2
0
        public override void EnterEnumDeclaration(JavaParser.EnumDeclarationContext context)
        {
            string name = context.IDENTIFIER().GetText();

            string enumPackageFqn = string.IsNullOrEmpty(packageFqn)
                ? name
                : $"{packageFqn}.{name}";

            ClassName enumName = new ClassName($"{parentFilePath}|{enumPackageFqn}");

            EnumBodyDeclarationsListener enumBodyDeclarationsListener =
                new EnumBodyDeclarationsListener(enumName, parentFilePath, packageFqn);

            context.enumBodyDeclarations().EnterRule(enumBodyDeclarationsListener);

            EnumInfo = new ClassInfo(
                enumName,
                new List <MethodInfo>(),
                enumBodyDeclarationsListener.FieldInfos,
                modifier,
                new List <ClassInfo>(),
                new SourceCodeSnippet("", SourceCodeLanguage.Java),
                false);
        }