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
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumType formatting to apply. -
Field Summary
Fields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTY -
Method Summary
Modifier and TypeMethodDescriptiondefault @NonNull ParameterizedTypeRepresent this argument as aParameterizedType.default @NonNull TypeasType()Represent this argument as aType.default StringgetBeanTypeString(@NonNull TypeInformation.TypeFormat format) Similar togetTypeString(TypeFormat)but includes any scopes and qualifiers.default @NonNull StringObtains the type's simple name.getType()default @NonNull Stringdefault StringgetTypeString(boolean simple) Returns the string representation of the argument type, including generics.default @NonNull StringgetTypeString(@NonNull TypeInformation.TypeFormat format) 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 booleandefault booleanisArray()default booleanisAsync()default booleandefault booleandefault booleandefault booleandefault booleandefault booleandefault booleandefault booleandefault booleanisVoid()Returns whether the return type is logically void.default booleanReturns 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, synthesizeDeclaredAnnotationsByTypeMethods inherited from interface io.micronaut.core.annotation.AnnotationSource
getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeDeclaredMethods 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:
getTypeNamein 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
-
getBeanTypeString
Similar togetTypeString(TypeFormat)but includes any scopes and qualifiers.- Parameters:
format- The format- Returns:
- The type string including the scope and qualifier
- See Also:
-
getTypeString
Returns the string representation of the argument type, including generics.- Parameters:
format- The format.- Returns:
- The type string representation
- Since:
- 4.8.0
-
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()
-