Package org.openrewrite.java.tree
Class J.FieldAccess
- java.lang.Object
-
- org.openrewrite.java.tree.J.FieldAccess
-
- All Implemented Interfaces:
java.io.Serializable
,Expression
,J
,NameTree
,TypeTree
,org.openrewrite.marker.Markable
,org.openrewrite.Tree
- Enclosing interface:
- J
public static final class J.FieldAccess extends java.lang.Object implements J, TypeTree, Expression
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
J.FieldAccess.Padding
-
Nested classes/interfaces inherited from interface org.openrewrite.java.tree.J
J.AnnotatedType, J.Annotation, J.ArrayAccess, J.ArrayDimension, J.ArrayType, J.Assert, J.Assignment, J.AssignmentOperation, J.Binary, J.Block, J.Break, J.Case, J.ClassDeclaration, J.CompilationUnit, J.Continue, J.ControlParentheses<J2 extends J>, J.DoWhileLoop, J.Empty, J.EnumValue, J.EnumValueSet, J.FieldAccess, J.ForEachLoop, J.ForLoop, J.Identifier, J.If, J.Import, J.InstanceOf, J.Label, J.Lambda, J.Literal, J.MemberReference, J.MethodDeclaration, J.MethodInvocation, J.Modifier, J.MultiCatch, J.NewArray, J.NewClass, J.Package, J.ParameterizedType, J.Parentheses<J2 extends J>, J.Primitive, J.Return, J.Switch, J.Synchronized, J.Ternary, J.Throw, J.Try, J.TypeCast, J.TypeParameter, J.TypeParameters, J.Unary, J.VariableDeclarations, J.WhileLoop, J.Wildcard
-
-
Constructor Summary
Constructors Constructor Description FieldAccess()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <P> J
acceptJava(JavaVisitor<P> v, P p)
@Nullable NameTree
asClassReference()
Coordinates.FieldAccess
getCoordinates()
J.Identifier
getName()
J.FieldAccess.Padding
getPadding()
java.util.List<org.openrewrite.Tree>
getSideEffects()
java.lang.String
getSimpleName()
boolean
isFullyQualifiedClassReference(java.lang.String className)
boolean
isFullyQualifiedClassReference(MethodMatcher methodMatcher)
Evaluate whether the specified MethodMatcher and this FieldAccess are describing the same type or not.java.lang.String
toString()
Make debugging a bit easierJ.FieldAccess
withName(J.Identifier name)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.openrewrite.java.tree.Expression
getType, withType
-
Methods inherited from interface org.openrewrite.java.tree.J
accept, getComments, getPrefix, print, print, withComments, withPrefix, withTemplate
-
-
-
-
Method Detail
-
getName
public J.Identifier getName()
-
withName
public J.FieldAccess withName(J.Identifier name)
-
acceptJava
public <P> J acceptJava(JavaVisitor<P> v, P p)
- Specified by:
acceptJava
in interfaceJ
-
getCoordinates
public Coordinates.FieldAccess getCoordinates()
- Specified by:
getCoordinates
in interfaceJ
-
getSimpleName
public java.lang.String getSimpleName()
-
getSideEffects
public java.util.List<org.openrewrite.Tree> getSideEffects()
- Specified by:
getSideEffects
in interfaceExpression
- Returns:
- A list of the side effects emitted by the statement, if the statement was decomposed. So for a binary operation, there are up to two potential side effects (the left and right side) and as few as zero if both sides of the expression are something like constants or variable references.
-
toString
public java.lang.String toString()
Make debugging a bit easier- Overrides:
toString
in classjava.lang.Object
-
asClassReference
@Nullable public @Nullable NameTree asClassReference()
- Returns:
- For expressions like
String.class
, this casts target expression to aNameTree
. If the field access is not a reference to a class type, returns null.
-
isFullyQualifiedClassReference
public boolean isFullyQualifiedClassReference(java.lang.String className)
-
isFullyQualifiedClassReference
public boolean isFullyQualifiedClassReference(MethodMatcher methodMatcher)
Evaluate whether the specified MethodMatcher and this FieldAccess are describing the same type or not. Known limitation/bug: MethodMatchers can have patterns/wildcards like "com.*.Bar" instead of something concrete like "com.foo.Bar". This limitation is not desirable or intentional and should be fixed. If a methodMatcher is passed that includes wildcards the result will always be "false"- Parameters:
methodMatcher
- a methodMatcher whose internal pattern is fully concrete (no wildcards)
-
getPadding
public J.FieldAccess.Padding getPadding()
-
-