Package org.openrewrite.java
Interface JavaSourceVisitor<R>
-
- All Superinterfaces:
org.openrewrite.SourceVisitor<R>
- All Known Implementing Classes:
AbstractJavaSourceVisitor
,AddAnnotation.Scoped
,AddField.Scoped
,AddImport
,AutoFormat
,ChangeFieldName.Scoped
,ChangeFieldType
,ChangeFieldType.Scoped
,ChangeLiteral.Scoped
,ChangeMethodName
,ChangeMethodName.Scoped
,ChangeMethodTargetToStatic
,ChangeMethodTargetToStatic.Scoped
,ChangeMethodTargetToVariable
,ChangeMethodTargetToVariable.Scoped
,ChangeType
,DeleteMethodArgument
,DeleteMethodArgument.Scoped
,DeleteStatement.Scoped
,FillTypeAttributions
,FindAnnotations
,FindFields
,FindIndentJava
,FindInheritedFields
,FindMethods
,FindReferencedTypes
,FindReferencesToVariable
,FindType
,GenerateConstructorUsingFields.Scoped
,GenerateGetter.Scoped
,GenerateNewBeanUsingProperties.Scoped
,GenerateSetter.Scoped
,HasImport
,HasType
,ImplementInterface.Scoped
,InsertDeclaration.Scoped
,InsertMethodArgument
,InsertMethodArgument.Scoped
,JavaIsoRefactorVisitor
,JavaRefactorVisitor
,OrderDeclarations
,OrderDeclarations.Scoped
,OrderImports
,PrintJava
,RemoveImport
,RenameVariable
,ReorderMethodArguments
,ReorderMethodArguments.Scoped
,RetrieveCursor
,SemanticallyEqual
,ShiftFormatRightVisitor
,SpansMultipleLines
,UnwrapParentheses.Scoped
,UseStaticImport
,UseStaticImport.Scoped
,VisitRecorder
public interface JavaSourceVisitor<R> extends org.openrewrite.SourceVisitor<R>
-
-
Method Summary
-
-
-
Method Detail
-
enclosingCompilationUnit
default J.CompilationUnit enclosingCompilationUnit()
-
enclosingBlock
default J.Block<?> enclosingBlock()
-
enclosingMethod
@Nullable default J.MethodDecl enclosingMethod()
-
enclosingClass
default J.ClassDecl enclosingClass()
-
isInSameNameScope
default boolean isInSameNameScope(org.openrewrite.Cursor base, org.openrewrite.Cursor child)
Check if a child AST element is in the same lexical scope as that of the AST element associated with the base cursor. (i.e.: Are the variables and declarations visible in the base scope also visible to the child AST element?) The base lexical scope is first established by walking up the path of the base cursor to find its first enclosing element. The child path is traversed by walking up the child path elements until either the base scope has been found, a "terminating" element is encountered, or there are no more elements in the path.A terminating element is one of the following:
- A static class declaration
- An enumeration declaration
- An interface declaration
- An annotation declaration
- Parameters:
base
- A pointer within the AST that is used to establish the "base lexical scope".child
- A pointer within the AST that will be traversed (up the tree) looking for an intersection with the base lexical scope.- Returns:
- true if the child is in within the lexical scope of the base
-
isInSameNameScope
default boolean isInSameNameScope(org.openrewrite.Cursor child)
Check if a child AST element is in the same lexical scope as that of the AST element associated with the current cursor. SeeisInSameNameScope(org.openrewrite.Cursor, org.openrewrite.Cursor)
- Parameters:
child
- A pointer to an element within the abstract syntax tree- Returns:
- true if the child is in within the lexical scope of the current cursor
-
visitExpression
default R visitExpression(Expression expr)
-
visitAnnotatedType
R visitAnnotatedType(J.AnnotatedType annotatedType)
-
visitAnnotation
R visitAnnotation(J.Annotation annotation)
-
visitArrayAccess
R visitArrayAccess(J.ArrayAccess arrayAccess)
-
visitArrayType
R visitArrayType(J.ArrayType arrayType)
-
visitAssignOp
R visitAssignOp(J.AssignOp assignOp)
-
visitCatch
R visitCatch(J.Try.Catch catzh)
-
visitClassDecl
R visitClassDecl(J.ClassDecl classDecl)
-
visitCompilationUnit
R visitCompilationUnit(J.CompilationUnit cu)
-
visitContinue
R visitContinue(J.Continue continueStatement)
-
visitDoWhileLoop
R visitDoWhileLoop(J.DoWhileLoop doWhileLoop)
-
visitEnumValue
R visitEnumValue(J.EnumValue enoom)
-
visitEnumValueSet
R visitEnumValueSet(J.EnumValueSet enums)
-
visitFinally
R visitFinally(J.Try.Finally finallie)
-
visitFieldAccess
R visitFieldAccess(J.FieldAccess fieldAccess)
-
visitForEachLoop
R visitForEachLoop(J.ForEachLoop forEachLoop)
-
visitInstanceOf
R visitInstanceOf(J.InstanceOf instanceOf)
-
visitMemberReference
R visitMemberReference(J.MemberReference memberRef)
-
visitMethod
R visitMethod(J.MethodDecl method)
-
visitMethodInvocation
R visitMethodInvocation(J.MethodInvocation method)
-
visitMultiCatch
R visitMultiCatch(J.MultiCatch multiCatch)
-
visitMultiVariable
R visitMultiVariable(J.VariableDecls multiVariable)
-
visitNewArray
R visitNewArray(J.NewArray newArray)
-
visitNewClass
R visitNewClass(J.NewClass newClass)
-
visitParameterizedType
R visitParameterizedType(J.ParameterizedType type)
-
visitParentheses
<T extends J> R visitParentheses(J.Parentheses<T> parens)
-
visitPrimitive
R visitPrimitive(J.Primitive primitive)
-
visitSynchronized
R visitSynchronized(J.Synchronized synch)
-
visitTypeCast
R visitTypeCast(J.TypeCast typeCast)
-
visitTypeParameter
R visitTypeParameter(J.TypeParameter typeParam)
-
visitTypeParameters
R visitTypeParameters(J.TypeParameters typeParams)
-
visitUnparsedSource
R visitUnparsedSource(J.UnparsedSource unparsed)
-
visitVariable
R visitVariable(J.VariableDecls.NamedVar variable)
-
visitWhileLoop
R visitWhileLoop(J.WhileLoop whileLoop)
-
visitWildcard
R visitWildcard(J.Wildcard wildcard)
-
-