Package com.google.auto.value.processor
Class Optionalish
java.lang.Object
com.google.auto.value.processor.Optionalish
A wrapper for properties of Optional-like classes. This can be com.google.common.base.Optional,
or any of Optional, OptionalDouble, OptionalInt, OptionalLong in java.util.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String
private static final com.google.common.collect.ImmutableSet<String>
private final DeclaredType
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static Optionalish
createIfOptional
(TypeMirror type) Returns an instance wrapping the given TypeMirror, or null if it is not any kind of Optional.private TypeMirror
getContainedPrimitiveType
(Types typeUtils) (package private) TypeMirror
getContainedType
(Types typeUtils) getEmpty()
Returns a string representing the method call to obtain the empty version of this Optional.Returns a string representing the raw type of this Optional.(package private) static boolean
isOptional
(TypeMirror type) (package private) String
-
Field Details
-
OPTIONAL_CLASS_NAMES
-
optionalType
-
className
-
PRIMITIVE_TYPE_KINDS
-
-
Constructor Details
-
Optionalish
-
-
Method Details
-
createIfOptional
Returns an instance wrapping the given TypeMirror, or null if it is not any kind of Optional.- Parameters:
type
- the TypeMirror for the original optional type, for exampleOptional<String>
.
-
isOptional
-
getRawType
Returns a string representing the raw type of this Optional. This will typically be just"Optional"
, but it might be"OptionalInt"
or"java.util.Optional"
for example. -
getEmpty
Returns a string representing the method call to obtain the empty version of this Optional. This will be something like"Optional.empty()"
or possibly"java.util.Optional.empty()"
. It does not have a final semicolon.This method is public so that it can be referenced as
p.optional.empty
from templates. -
getContainedType
-
ofNullable
String ofNullable() -
getContainedPrimitiveType
-