Package io.micronaut.core.type
Interface TypeInformation<T>
- Type Parameters:
T
- The generic type
- All Superinterfaces:
AnnotationMetadataProvider
,AnnotationSource
,Type
,TypeVariableResolver
- All Known Subinterfaces:
Argument<T>
,ArgumentValue<V>
,GenericPlaceholder<T>
,MutableArgumentValue<V>
,ReturnType<T>
- All Known Implementing Classes:
ArgumentBeanType
,DefaultArgument
,GenericArgument
Provides information about a type at runtime.
- Since:
- 2.4.0
- Author:
- graemerocher
-
Field Summary
Fields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTY
-
Method Summary
Modifier and TypeMethodDescriptiondefault @NonNull ParameterizedType
Represent this argument as aParameterizedType
.asType()
Represent this argument as aType
.Obtains the type's simple name.getType()
default String
getTypeString
(boolean simple) Returns the string representation of the argument type, including generics.default Argument<?>
Returns the wrapped type in the case whereisWrapperType()
returns true.default Class<?>
If the type is primitive returns the wrapper type, otherwise returns the actual type.default boolean
default boolean
isArray()
default boolean
isAsync()
default boolean
default boolean
default boolean
default boolean
default boolean
default boolean
default boolean
default boolean
default boolean
isVoid()
Returns whether the return type is logically void.default boolean
Returns whether this type is a wrapper type that wraps the actual type such as an Optional or a Response wrapper.Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider
findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, getAnnotationMetadata, getTargetAnnotationMetadata, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType
Methods inherited from interface io.micronaut.core.annotation.AnnotationSource
getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeDeclared
Methods inherited from interface io.micronaut.core.type.TypeVariableResolver
getFirstTypeVariable, getTypeParameters, getTypeVariable, getTypeVariables
-
Method Details
-
getType
- Returns:
- The type
-
isPrimitive
default boolean isPrimitive()- Returns:
- Is the type primitive.
- Since:
- 3.0.0
-
getWrapperType
If the type is primitive returns the wrapper type, otherwise returns the actual type.- Returns:
- The wrapper type if primitive
-
getTypeName
- Specified by:
getTypeName
in interfaceType
-
isReactive
default boolean isReactive()- Returns:
- Is the return type reactive.
- Since:
- 2.0.0
-
isWrapperType
default boolean isWrapperType()Returns whether this type is a wrapper type that wraps the actual type such as an Optional or a Response wrapper.- Returns:
- True if it is a wrapper type.
- Since:
- 2.4.0
-
getWrappedType
Returns the wrapped type in the case whereisWrapperType()
returns true.- Returns:
- The wrapped type
-
isCompletable
default boolean isCompletable()- Returns:
- Is the return type a reactive completable type.
- Since:
- 2.0.0
-
isAsync
default boolean isAsync()- Returns:
- Is the return type asynchronous.
- Since:
- 2.0.0
-
isAsyncOrReactive
default boolean isAsyncOrReactive()- Returns:
- Is the return type either async or reactive.
- Since:
- 2.0.0
-
isContainerType
default boolean isContainerType()- Returns:
- Whether this is a container type.
-
hasTypeVariables
default boolean hasTypeVariables()- Returns:
- Whether the argument has any type variables
-
getTypeString
Returns the string representation of the argument type, including generics.- Parameters:
simple
- If true, output the simple name of types- Returns:
- The type string representation
-
isVoid
default boolean isVoid()Returns whether the return type is logically void. This includes reactive times that emit nothing (such asio.micronaut.core.async.subscriber.Completable
) and asynchronous types that emitVoid
.- Returns:
- Is the return type logically void.
- Since:
- 2.0.0
-
isOptional
default boolean isOptional()- Returns:
- Is the return type
Optional
. - Since:
- 2.0.1
-
isSpecifiedSingle
default boolean isSpecifiedSingle()- Returns:
- Has the return type been specified to emit a single result with
SingleResult
. - Since:
- 2.0
-
asType
Represent this argument as aType
.- Returns:
- The
Type
- Since:
- 3.5.2
-
asParameterizedType
Represent this argument as aParameterizedType
.- Returns:
- The
ParameterizedType
- Since:
- 2.0.0
-
isArray
default boolean isArray()- Returns:
- Is the type an array.
- Since:
- 2.4.0
-
getSimpleName
Obtains the type's simple name.- Returns:
- The simple name
- Since:
- 3.0.0
-
isProvider
default boolean isProvider()
-