public class OptionalUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
GUAVA_OPTIONAL |
static CallMatcher |
GUAVA_OPTIONAL_FROM_NULLABLE |
static CallMatcher |
GUAVA_OPTIONAL_GET |
static CallMatcher |
JDK_OPTIONAL_DOUBLE_GET |
static CallMatcher |
JDK_OPTIONAL_GET |
static CallMatcher |
JDK_OPTIONAL_INT_GET |
static CallMatcher |
JDK_OPTIONAL_LONG_GET |
static CallMatcher |
JDK_OPTIONAL_OF_NULLABLE |
static CallMatcher |
JDK_OPTIONAL_WRAP_METHOD |
static java.lang.String |
OPTIONAL_DOUBLE |
static CallMatcher |
OPTIONAL_GET |
static java.lang.String |
OPTIONAL_INT |
static java.lang.String |
OPTIONAL_LONG |
static CallMatcher |
OPTIONAL_OF_NULLABLE |
Constructor and Description |
---|
OptionalUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getOptionalClass(java.lang.String type) |
static PsiType |
getOptionalElementType(PsiType type)
Unwraps an
Optional , OptionalInt , OptionalLong or OptionalDouble
returning its element type |
static boolean |
isJdkOptionalClassName(java.lang.String className) |
static boolean |
isOptionalEmptyCall(PsiExpression expression) |
public static final java.lang.String OPTIONAL_INT
public static final java.lang.String OPTIONAL_LONG
public static final java.lang.String OPTIONAL_DOUBLE
public static final java.lang.String GUAVA_OPTIONAL
public static final CallMatcher GUAVA_OPTIONAL_FROM_NULLABLE
public static final CallMatcher JDK_OPTIONAL_OF_NULLABLE
public static final CallMatcher OPTIONAL_OF_NULLABLE
public static final CallMatcher JDK_OPTIONAL_GET
public static final CallMatcher JDK_OPTIONAL_INT_GET
public static final CallMatcher JDK_OPTIONAL_LONG_GET
public static final CallMatcher JDK_OPTIONAL_DOUBLE_GET
public static final CallMatcher GUAVA_OPTIONAL_GET
public static final CallMatcher OPTIONAL_GET
public static final CallMatcher JDK_OPTIONAL_WRAP_METHOD
public static java.lang.String getOptionalClass(java.lang.String type)
public static boolean isJdkOptionalClassName(java.lang.String className)
public static PsiType getOptionalElementType(PsiType type)
Optional
, OptionalInt
, OptionalLong
or OptionalDouble
returning its element typetype
- a type representing optional (e.g. Optional<String>
or OptionalInt
)String
or int
). Returns null
if the supplied type is not an optional type
or its a raw java.util.Optional
.public static boolean isOptionalEmptyCall(PsiExpression expression)