Class MethodExtension
java.lang.Object
org.emftext.language.java.extensions.members.MethodExtension
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Block
Returns a block representing the body of a method.getStatements
(Method me) Deprecated.Use getBlock().getStatements().static boolean
isBetterMethodForCall
(Method me, Method otherMethod, MethodCall methodCall) static boolean
isMethodForCall
(Method me, MethodCall methodCall, boolean needsPerfectMatch) static boolean
isSignatureMatching
(Method one, Method two) Checks if the signature, i.static boolean
isSignatureMatching
(Method one, Method two, Type twoFirstParameter) Checks if the signature, i.static boolean
isSomeMethodForCall
(Method me, MethodCall methodCall) Returnstrue
if the given method matches the given call.
-
Constructor Details
-
MethodExtension
public MethodExtension()
-
-
Method Details
-
isSomeMethodForCall
Returnstrue
if the given method matches the given call.- Parameters:
me
- the given method.methodCall
- the method call.- Returns:
- true if the method matches. false otherwise.
-
isBetterMethodForCall
Returnstrue
if the givenMethod
me
is a better match for the given method call thanMethod
otherMethod
.- Parameters:
me
- the given method.otherMethod
- the other method.methodCall
- the method call.- Returns:
- true or false.
-
isMethodForCall
-
isSignatureMatching
Checks if the signature, i. e., the parameter types and return type, of two methods match, independently of the method and parameter names. It is possible for one method to have specialized parameter and return types compared to the other method.- Parameters:
one
- the first method.two
- the second method which can have specialized types.- Returns:
- true if the signatures match. false otherwise.
-
isSignatureMatching
Checks if the signature, i. e., the parameter types and return type, of two methods match, independently of the method and parameter names. It is possible for one method to have specialized parameter and return types compared to the other method. If the comparison is for finding the referenced method within a MethodReferenceExpression, e. g., StringBuilder::append, where the type of the primary expression (in the example StringBuilder) can be part of the parameter types of the second method, the type can be given.- Parameters:
one
- the first method.two
- the second method which can have specialized types.twoFirstParameter
- the type in case of MethodReferenceExpressions which is counted as the first parameter type of the second method.- Returns:
- true if the signatures match. false otherwise.
-
getStatements
Deprecated.Use getBlock().getStatements().Returns a list of all statements within the block of a method. This is a legacy method to provide a stable and backwards-compatible API.- Parameters:
me
- the method for which the statements are obtained.- Returns:
- the list of all statements.
-
getBlock
Returns a block representing the body of a method.- Parameters:
me
- the method for which the body is returned.- Returns:
- the block or null if the method has no implementation.
-