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 aMethodOrConstructorrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncom.github.javaparser.ast.expr.MethodCallExprReturn the wrapped node as aMethodCallExpror blow up.com.github.javaparser.ast.NodeasNode()Return the wrapped node as aNode.com.github.javaparser.ast.nodeTypes.NodeWithArguments<?>Return the wrapped node as aNodeWithArguments.com.github.javaparser.ast.expr.ObjectCreationExprReturn the wrapped node as aObjectCreationExpror blow up.final booleanIndicates whether some other object is "equal to" this one.com.github.javaparser.ast.NodeList<?>Get the arguments for the call.com.github.javaparser.RangegetRange()This assumes a range is present, and explodes if it doesn't.final inthashCode()Returns a hash code value for this object.booleanhasRange()Return true if the node has a range, meaning it was not added by us.booleanReturn true if this is a constructor call.booleanisConstructorForType(String type) Return true if this is a constructor call for the given type.booleanReturn true if this is a method call.booleanisMethodCallWithName(String name) Return true if this is a method call and it has the given name.booleanisMethodCallWithNameIn(Collection<String> names) Return true if this is a method call and it has one of the given names.booleanReturn true if this is a method call with a scope.com.github.javaparser.ast.Nodenode()Returns the value of thenoderecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
MethodOrConstructor
public MethodOrConstructor(com.github.javaparser.ast.Node node) Creates an instance of aMethodOrConstructorrecord class.- Parameters:
node- the value for thenoderecord 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 aMethodCallExpror blow up. -
asObjectCreationExpr
public com.github.javaparser.ast.expr.ObjectCreationExpr asObjectCreationExpr()Return the wrapped node as aObjectCreationExpror 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 thenoderecord component.- Returns:
- the value of the
noderecord component
-