public class LambdaRefactoringUtil
extends java.lang.Object
Constructor and Description |
---|
LambdaRefactoringUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean |
canConvertToLambda(PsiMethodReferenceExpression referenceExpression) |
static boolean |
canConvertToLambdaWithoutSideEffects(PsiMethodReferenceExpression methodReferenceExpression)
Checks whether method reference can be converted to lambda without significant semantics change
(i.e.
|
static PsiLambdaExpression |
convertMethodReferenceToLambda(PsiMethodReferenceExpression referenceExpression,
boolean ignoreCast,
boolean simplifyToExpressionLambda) |
static PsiExpression |
convertToMethodCallInLambdaBody(PsiMethodReferenceExpression element) |
static PsiLambdaExpression |
createLambda(PsiMethodReferenceExpression referenceExpression,
boolean doNotAddParameterTypes)
Convert method reference to lambda if possible and return the created lambda without replacing original method reference.
|
static void |
removeSideEffectsFromLambdaBody(Editor editor,
PsiLambdaExpression lambdaExpression)
Works for expression lambdas/one statement code block lambdas to ensures equivalent method ref -> lambda transformation.
|
static void |
simplifyToExpressionLambda(PsiLambdaExpression lambdaExpression) |
public static PsiExpression convertToMethodCallInLambdaBody(PsiMethodReferenceExpression element)
public static PsiLambdaExpression convertMethodReferenceToLambda(PsiMethodReferenceExpression referenceExpression, boolean ignoreCast, boolean simplifyToExpressionLambda)
public static boolean canConvertToLambda(PsiMethodReferenceExpression referenceExpression)
public static PsiLambdaExpression createLambda(PsiMethodReferenceExpression referenceExpression, boolean doNotAddParameterTypes)
referenceExpression
- a method reference to convertdoNotAddParameterTypes
- if false, parameter types could be added to the lambda to resolve ambiguitypublic static void simplifyToExpressionLambda(PsiLambdaExpression lambdaExpression)
public static void removeSideEffectsFromLambdaBody(Editor editor, PsiLambdaExpression lambdaExpression)
public static boolean canConvertToLambdaWithoutSideEffects(PsiMethodReferenceExpression methodReferenceExpression)
methodReferenceExpression
- method reference to check