Package org.eclipse.steady.java
Class JavaFileAnalyzer2
- java.lang.Object
-
- org.eclipse.steady.java.antlr.JavaParserBaseListener
-
- org.eclipse.steady.java.JavaFileAnalyzer2
-
- All Implemented Interfaces:
org.antlr.v4.runtime.tree.ParseTreeListener,FileAnalyzer,JavaParserListener
public class JavaFileAnalyzer2 extends JavaParserBaseListener implements FileAnalyzer
Analyzes java source files using ANTLR.
-
-
Constructor Summary
Constructors Constructor Description JavaFileAnalyzer2()
-
Method Summary
-
Methods inherited from class org.eclipse.steady.java.antlr.JavaParserBaseListener
enterAnnotation, enterAnnotationConstantRest, enterAnnotationMethodOrConstantRest, enterAnnotationMethodRest, enterAnnotationTypeBody, enterAnnotationTypeDeclaration, enterAnnotationTypeElementDeclaration, enterAnnotationTypeElementRest, enterArguments, enterArrayCreatorRest, enterArrayInitializer, enterBlock, enterBlockStatement, enterCatchClause, enterCatchType, enterClassBodyDeclaration, enterClassCreatorRest, enterClassOrInterfaceModifier, enterClassOrInterfaceType, enterClassType, enterCompilationUnit, enterConstantDeclarator, enterConstDeclaration, enterCreatedName, enterCreator, enterDefaultValue, enterElementValue, enterElementValueArrayInitializer, enterElementValuePair, enterElementValuePairs, enterEnhancedForControl, enterEnumBodyDeclarations, enterEnumConstant, enterEnumConstants, enterEveryRule, enterExplicitGenericInvocation, enterExplicitGenericInvocationSuffix, enterExpression, enterExpressionList, enterFieldDeclaration, enterFinallyBlock, enterFloatLiteral, enterForControl, enterForInit, enterFormalParameter, enterFormalParameterList, enterFormalParameters, enterGenericConstructorDeclaration, enterGenericInterfaceMethodDeclaration, enterGenericMethodDeclaration, enterImportDeclaration, enterInnerCreator, enterIntegerLiteral, enterInterfaceBody, enterInterfaceBodyDeclaration, enterInterfaceMemberDeclaration, enterInterfaceMethodDeclaration, enterInterfaceMethodModifier, enterLambdaBody, enterLambdaExpression, enterLambdaParameters, enterLastFormalParameter, enterLiteral, enterLocalTypeDeclaration, enterLocalVariableDeclaration, enterMemberDeclaration, enterMethodBody, enterModifier, enterNonWildcardTypeArguments, enterNonWildcardTypeArgumentsOrDiamond, enterParExpression, enterPrimary, enterPrimitiveType, enterQualifiedName, enterQualifiedNameList, enterResource, enterResources, enterResourceSpecification, enterStatement, enterSuperSuffix, enterSwitchBlockStatementGroup, enterSwitchLabel, enterTypeArgument, enterTypeArguments, enterTypeArgumentsOrDiamond, enterTypeBound, enterTypeDeclaration, enterTypeList, enterTypeParameter, enterTypeParameters, enterTypeType, enterTypeTypeOrVoid, enterVariableDeclarator, enterVariableDeclaratorId, enterVariableDeclarators, enterVariableInitializer, enterVariableModifier, exitAnnotation, exitAnnotationConstantRest, exitAnnotationMethodOrConstantRest, exitAnnotationMethodRest, exitAnnotationTypeBody, exitAnnotationTypeDeclaration, exitAnnotationTypeElementDeclaration, exitAnnotationTypeElementRest, exitArguments, exitArrayCreatorRest, exitArrayInitializer, exitBlock, exitBlockStatement, exitCatchClause, exitCatchType, exitClassBodyDeclaration, exitClassCreatorRest, exitClassOrInterfaceModifier, exitClassOrInterfaceType, exitClassType, exitCompilationUnit, exitConstantDeclarator, exitConstDeclaration, exitCreatedName, exitCreator, exitDefaultValue, exitElementValue, exitElementValueArrayInitializer, exitElementValuePair, exitElementValuePairs, exitEnhancedForControl, exitEnumBodyDeclarations, exitEnumConstant, exitEnumConstants, exitEveryRule, exitExplicitGenericInvocation, exitExplicitGenericInvocationSuffix, exitExpression, exitExpressionList, exitFieldDeclaration, exitFinallyBlock, exitFloatLiteral, exitForControl, exitForInit, exitFormalParameter, exitFormalParameterList, exitFormalParameters, exitGenericConstructorDeclaration, exitGenericInterfaceMethodDeclaration, exitGenericMethodDeclaration, exitImportDeclaration, exitInnerCreator, exitIntegerLiteral, exitInterfaceBody, exitInterfaceBodyDeclaration, exitInterfaceMemberDeclaration, exitInterfaceMethodDeclaration, exitInterfaceMethodModifier, exitLambdaBody, exitLambdaExpression, exitLambdaParameters, exitLastFormalParameter, exitLiteral, exitLocalTypeDeclaration, exitLocalVariableDeclaration, exitMemberDeclaration, exitMethodBody, exitModifier, exitNonWildcardTypeArguments, exitNonWildcardTypeArgumentsOrDiamond, exitPackageDeclaration, exitParExpression, exitPrimary, exitPrimitiveType, exitQualifiedName, exitQualifiedNameList, exitResource, exitResources, exitResourceSpecification, exitStatement, exitSuperSuffix, exitSwitchBlockStatementGroup, exitSwitchLabel, exitTypeArgument, exitTypeArguments, exitTypeArgumentsOrDiamond, exitTypeBound, exitTypeDeclaration, exitTypeList, exitTypeParameter, exitTypeParameters, exitTypeType, exitTypeTypeOrVoid, exitVariableDeclarator, exitVariableDeclaratorId, exitVariableDeclarators, exitVariableInitializer, exitVariableModifier, visitErrorNode, visitTerminal
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.steady.FileAnalyzer
equals, hashCode
-
-
-
-
Method Detail
-
getSupportedFileExtensions
public String[] getSupportedFileExtensions()
- Specified by:
getSupportedFileExtensionsin interfaceFileAnalyzer
-
canAnalyze
public boolean canAnalyze(File _file)
- Specified by:
canAnalyzein interfaceFileAnalyzer
-
analyze
public void analyze(File _file) throws FileAnalysisException
- Specified by:
analyzein interfaceFileAnalyzer- Throws:
FileAnalysisException
-
setFile
public void setFile(File _file) throws IllegalArgumentException
Setter for the field
file.- Parameters:
_file- aFileobject.- Throws:
IllegalArgumentException- if any.
-
enterPackageDeclaration
public void enterPackageDeclaration(@NotNull JavaParser.PackageDeclarationContext ctx)Enter a parse tree produced byJavaParser.packageDeclaration().The default implementation does nothing.
- Specified by:
enterPackageDeclarationin interfaceJavaParserListener- Overrides:
enterPackageDeclarationin classJavaParserBaseListener- Parameters:
ctx- the parse tree
-
enterEnumDeclaration
public void enterEnumDeclaration(@NotNull JavaParser.EnumDeclarationContext ctx)Enter a parse tree produced byJavaParser.enumDeclaration().The default implementation does nothing.
Enums are added toconstructs.- Specified by:
enterEnumDeclarationin interfaceJavaParserListener- Overrides:
enterEnumDeclarationin classJavaParserBaseListener- Parameters:
ctx- the parse tree
-
exitEnumDeclaration
public void exitEnumDeclaration(@NotNull JavaParser.EnumDeclarationContext ctx)Exit a parse tree produced byJavaParser.enumDeclaration().The default implementation does nothing.
- Specified by:
exitEnumDeclarationin interfaceJavaParserListener- Overrides:
exitEnumDeclarationin classJavaParserBaseListener- Parameters:
ctx- the parse tree
-
enterInterfaceDeclaration
public void enterInterfaceDeclaration(@NotNull JavaParser.InterfaceDeclarationContext ctx)Enter a parse tree produced byJavaParser.interfaceDeclaration().The default implementation does nothing.
Interfaces are not added toconstructs.- Specified by:
enterInterfaceDeclarationin interfaceJavaParserListener- Overrides:
enterInterfaceDeclarationin classJavaParserBaseListener- Parameters:
ctx- the parse tree
-
exitInterfaceDeclaration
public void exitInterfaceDeclaration(@NotNull JavaParser.InterfaceDeclarationContext ctx)Exit a parse tree produced byJavaParser.interfaceDeclaration().The default implementation does nothing.
- Specified by:
exitInterfaceDeclarationin interfaceJavaParserListener- Overrides:
exitInterfaceDeclarationin classJavaParserBaseListener- Parameters:
ctx- the parse tree
-
enterClassDeclaration
public void enterClassDeclaration(@NotNull JavaParser.ClassDeclarationContext ctx)Enter a parse tree produced byJavaParser.classDeclaration().The default implementation does nothing.
- Specified by:
enterClassDeclarationin interfaceJavaParserListener- Overrides:
enterClassDeclarationin classJavaParserBaseListener- Parameters:
ctx- the parse tree
-
exitClassDeclaration
public void exitClassDeclaration(@NotNull JavaParser.ClassDeclarationContext ctx)Exit a parse tree produced byJavaParser.classDeclaration().The default implementation does nothing.
- Specified by:
exitClassDeclarationin interfaceJavaParserListener- Overrides:
exitClassDeclarationin classJavaParserBaseListener- Parameters:
ctx- the parse tree
-
enterClassBody
public void enterClassBody(@NotNull JavaParser.ClassBodyContext ctx)Enter a parse tree produced byJavaParser.classBody().The default implementation does nothing.
- Specified by:
enterClassBodyin interfaceJavaParserListener- Overrides:
enterClassBodyin classJavaParserBaseListener- Parameters:
ctx- the parse tree
-
exitClassBody
public void exitClassBody(@NotNull JavaParser.ClassBodyContext ctx)Exit a parse tree produced byJavaParser.classBody().The default implementation does nothing.
- Specified by:
exitClassBodyin interfaceJavaParserListener- Overrides:
exitClassBodyin classJavaParserBaseListener- Parameters:
ctx- the parse tree
-
enterMethodDeclaration
public void enterMethodDeclaration(@NotNull JavaParser.MethodDeclarationContext ctx)Enter a parse tree produced byJavaParser.methodDeclaration().The default implementation does nothing.
- Specified by:
enterMethodDeclarationin interfaceJavaParserListener- Overrides:
enterMethodDeclarationin classJavaParserBaseListener- Parameters:
ctx- the parse tree
-
exitMethodDeclaration
public void exitMethodDeclaration(JavaParser.MethodDeclarationContext ctx)
Exit a parse tree produced byJavaParser.methodDeclaration().The default implementation does nothing.
- Specified by:
exitMethodDeclarationin interfaceJavaParserListener- Overrides:
exitMethodDeclarationin classJavaParserBaseListener- Parameters:
ctx- the parse tree
-
enterConstructorDeclaration
public void enterConstructorDeclaration(@NotNull JavaParser.ConstructorDeclarationContext ctx)Enter a parse tree produced byJavaParser.constructorDeclaration().The default implementation does nothing.
- Specified by:
enterConstructorDeclarationin interfaceJavaParserListener- Overrides:
enterConstructorDeclarationin classJavaParserBaseListener- Parameters:
ctx- the parse tree
-
exitConstructorDeclaration
public void exitConstructorDeclaration(JavaParser.ConstructorDeclarationContext ctx)
Exit a parse tree produced byJavaParser.constructorDeclaration().The default implementation does nothing.
- Specified by:
exitConstructorDeclarationin interfaceJavaParserListener- Overrides:
exitConstructorDeclarationin classJavaParserBaseListener- Parameters:
ctx- the parse tree
-
getConstructs
public Map<ConstructId,Construct> getConstructs() throws FileAnalysisException
- Specified by:
getConstructsin interfaceFileAnalyzer- Throws:
FileAnalysisException
-
containsConstruct
public boolean containsConstruct(ConstructId _id) throws FileAnalysisException
- Specified by:
containsConstructin interfaceFileAnalyzer- Throws:
FileAnalysisException
-
getConstruct
public Construct getConstruct(ConstructId _id) throws FileAnalysisException
- Specified by:
getConstructin interfaceFileAnalyzer- Throws:
FileAnalysisException
-
hasChilds
public boolean hasChilds()
- Specified by:
hasChildsin interfaceFileAnalyzer
-
getChilds
public Set<FileAnalyzer> getChilds(boolean _recursive)
- Specified by:
getChildsin interfaceFileAnalyzer
-
-