Package io.codemodder.remediation
Record Class MethodOrConstructor
java.lang.Object
java.lang.Record
io.codemodder.remediation.MethodOrConstructor
Convenience type to represent a method or constructor call in our APIs that work with both.
-
Constructor Summary
ConstructorsConstructorDescriptionMethodOrConstructor
(com.github.javaparser.ast.Node node) Creates an instance of aMethodOrConstructor
record class. -
Method Summary
Modifier and TypeMethodDescriptioncom.github.javaparser.ast.expr.MethodCallExpr
Return the wrapped node as aMethodCallExpr
or blow up.com.github.javaparser.ast.Node
asNode()
Return the wrapped node as aNode
.com.github.javaparser.ast.nodeTypes.NodeWithArguments<?>
Return the wrapped node as aNodeWithArguments
.final boolean
Indicates whether some other object is "equal to" this one.com.github.javaparser.ast.NodeList<?>
Get the arguments for the call.com.github.javaparser.Range
getRange()
This assumes a range is present, and explodes if it doesn't.final int
hashCode()
Returns a hash code value for this object.boolean
hasRange()
Return true if the node has a range, meaning it was not added by us.boolean
Return true if this is a constructor call.boolean
isConstructorForType
(String type) Return true if this is a constructor call for the given type.boolean
Return true if this is a method call.boolean
isMethodCallWithName
(String name) Return true if this is a method call and it has the given name.boolean
isMethodCallWithNameIn
(Collection<String> names) Return true if this is a method call and it has one of the given names.boolean
Return true if this is a method call with a scope.com.github.javaparser.ast.Node
node()
Returns the value of thenode
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
MethodOrConstructor
public MethodOrConstructor(com.github.javaparser.ast.Node node) Creates an instance of aMethodOrConstructor
record class.- Parameters:
node
- the value for thenode
record component
-
-
Method Details
-
asNode
public com.github.javaparser.ast.Node asNode()Return the wrapped node as aNode
. -
getRange
public com.github.javaparser.Range getRange()This assumes a range is present, and explodes if it doesn't. -
asNodeWithArguments
public com.github.javaparser.ast.nodeTypes.NodeWithArguments<?> asNodeWithArguments()Return the wrapped node as aNodeWithArguments
. -
getArguments
public com.github.javaparser.ast.NodeList<?> getArguments()Get the arguments for the call. -
isConstructor
public boolean isConstructor()Return true if this is a constructor call. -
isMethodCall
public boolean isMethodCall()Return true if this is a method call. -
isMethodCallWithScope
public boolean isMethodCallWithScope()Return true if this is a method call with a scope. -
isConstructorForType
Return true if this is a constructor call for the given type. -
hasRange
public boolean hasRange()Return true if the node has a range, meaning it was not added by us. -
isMethodCallWithName
Return true if this is a method call and it has the given name. -
isMethodCallWithNameIn
Return true if this is a method call and it has one of the given names. -
asMethodCall
public com.github.javaparser.ast.expr.MethodCallExpr asMethodCall()Return the wrapped node as aMethodCallExpr
or blow up. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
node
public com.github.javaparser.ast.Node node()Returns the value of thenode
record component.- Returns:
- the value of the
node
record component
-