Exemplo n.º 1
0
        public override void EnterMemberDeclaration(JavaParser.MemberDeclarationContext context)
        {
            // this member could be a method, class, or field
            if (context.methodDeclaration() != null)
            {
                MethodDeclarationListener methodDeclarationListener =
                    new MethodDeclarationListener(parentClass);
                context.methodDeclaration().EnterRule(methodDeclarationListener);
            }

            if (context.constructorDeclaration() != null)
            {
                ConstructorDeclarationListener constructorDeclarationListener =
                    new ConstructorDeclarationListener(parentClass);
                context.constructorDeclaration().EnterRule(constructorDeclarationListener);
            }

            if (context.fieldDeclaration() != null)
            {
                FieldDeclarationListener fieldDeclarationListener =
                    new FieldDeclarationListener(parentClass);
                context.fieldDeclaration().EnterRule(fieldDeclarationListener);
            }

            if (context.classDeclaration() != null)
            {
                ClassDeclarationListener classDeclarationListener =
                    new ClassDeclarationListener(parentClass);
                context.classDeclaration().EnterRule(classDeclarationListener);
            }
        }
Exemplo n.º 2
0
        public override void EnterMemberDeclaration(JavaParser.MemberDeclarationContext context)
        {
            // this member could be a method, class, or field
            if (context.methodDeclaration() != null)
            {
                MethodDeclarationListener methodDeclarationListener =
                    new MethodDeclarationListener(parentClassName);
                context.methodDeclaration().EnterRule(methodDeclarationListener);
                MethodInfo = methodDeclarationListener.MethodInfo;
            }

            if (context.constructorDeclaration() != null)
            {
                ConstructorDeclarationListener constructorDeclarationListener =
                    new ConstructorDeclarationListener(parentClassName);
                context.constructorDeclaration().EnterRule(constructorDeclarationListener);
                MethodInfo = constructorDeclarationListener.MethodInfo;
            }

            if (context.fieldDeclaration() != null)
            {
                FieldDeclarationListener fieldDeclarationListener =
                    new FieldDeclarationListener(parentClassName);
                context.fieldDeclaration().EnterRule(fieldDeclarationListener);
                FieldInfo = fieldDeclarationListener.FieldInfo;
            }

            if (context.classDeclaration() != null)
            {
                ClassDeclarationListener classDeclarationListener =
                    new ClassDeclarationListener(
                        package,
                        packageFqn,
                        AccessFlags.AccPrivate, // TODO
                        parentClassName);
                context.classDeclaration().EnterRule(classDeclarationListener);
                InnerClassInfo = classDeclarationListener.ClassInfo;
            }
        }
Exemplo n.º 3
0
        public override void EnterTypeDeclaration(JavaParser.TypeDeclarationContext context)
        {
            AccessFlags modifier = GetAccessFlags(context);

            if (context.annotationTypeDeclaration() != null)
            {
                AnnotationTypeDeclarationListener annotationTypeDeclarationListener =
                    new AnnotationTypeDeclarationListener();
                context.annotationTypeDeclaration().EnterRule(annotationTypeDeclarationListener);
            }

            // this type could be a class, enum, or interface
            if (context.classDeclaration() != null)
            {
                ClassDeclarationListener classDeclarationListener =
                    new ClassDeclarationListener(parentFilePath, packageFqn, modifier);
                context.classDeclaration().EnterRule(classDeclarationListener);
                OuterClassInfo = classDeclarationListener.ClassInfo;
            }

            if (context.interfaceDeclaration() != null)
            {
                InterfaceDeclarationListener interfaceDeclarationListener =
                    new InterfaceDeclarationListener(parentFilePath, packageFqn, modifier);
                context.interfaceDeclaration().EnterRule(interfaceDeclarationListener);
                InterfaceInfo = interfaceDeclarationListener.InterfaceInfo;
            }

            if (context.enumDeclaration() != null)
            {
                EnumDeclarationListener enumDeclarationListener =
                    new EnumDeclarationListener(parentFilePath, packageFqn, modifier);
                context.enumDeclaration().EnterRule(enumDeclarationListener);
                EnumInfo = enumDeclarationListener.EnumInfo;
            }
        }