public class OptionalRefactoringUtil
extends java.lang.Object
Constructor and Description |
---|
OptionalRefactoringUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
generateOptionalUnwrap(java.lang.String qualifier,
PsiVariable var,
PsiExpression trueExpression,
PsiExpression falseExpression,
PsiType targetType,
boolean useOrElseGet)
Generates an expression text which will unwrap an
Optional . |
static java.lang.String |
getMapTypeArgument(PsiExpression expression,
PsiType type) |
public static java.lang.String generateOptionalUnwrap(java.lang.String qualifier, PsiVariable var, PsiExpression trueExpression, PsiExpression falseExpression, PsiType targetType, boolean useOrElseGet)
Optional
.qualifier
- the text representing a qualifier of Optional typevar
- a variable used to refer optional value inside trueExpression
trueExpression
- an expression which should be evaluated if Optional is non-emptyfalseExpression
- an expression which should be returned if Optional is emptytargetType
- a type of target expressionuseOrElseGet
- if true, use orElseGet if necessaryOptional
.public static java.lang.String getMapTypeArgument(PsiExpression expression, PsiType type)