Package io.micronaut.core.type
Interface TypeInformation<T>
-
- Type Parameters:
T
- The generic type
- All Superinterfaces:
AnnotationMetadataProvider
,AnnotationSource
,java.lang.reflect.Type
,TypeVariableResolver
- All Known Subinterfaces:
Argument<T>
,ArgumentValue<V>
,GenericPlaceholder<T>
,MutableArgumentValue<V>
,ReturnType<T>
- All Known Implementing Classes:
DefaultArgument
,GenericArgument
public interface TypeInformation<T> extends TypeVariableResolver, AnnotationMetadataProvider, java.lang.reflect.Type
Provides information about a type at runtime.- Since:
- 2.4.0
-
-
Field Summary
-
Fields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTY
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.lang.reflect.ParameterizedType
asParameterizedType()
Represent this argument as aParameterizedType
.default java.lang.reflect.Type
asType()
Represent this argument as aType
.default java.lang.String
getSimpleName()
Obtains the type's simple name.java.lang.Class<T>
getType()
default java.lang.String
getTypeName()
default java.lang.String
getTypeString(boolean simple)
Returns the string representation of the argument type, including generics.default Argument<?>
getWrappedType()
Returns the wrapped type in the case whereisWrapperType()
returns true.default java.lang.Class<?>
getWrapperType()
If the type is primitive returns the wrapper type, otherwise returns the actual type.default boolean
hasTypeVariables()
default boolean
isArray()
default boolean
isAsync()
default boolean
isAsyncOrReactive()
default boolean
isCompletable()
default boolean
isContainerType()
default boolean
isOptional()
default boolean
isPrimitive()
default boolean
isProvider()
default boolean
isReactive()
default boolean
isSpecifiedSingle()
default boolean
isVoid()
Returns whether the return type is logically void.default boolean
isWrapperType()
Returns whether this type is a wrapper type that wraps the actual type such as a Optional or a Response wrapper.-
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider
findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, getAnnotationMetadata, 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 Detail
-
isPrimitive
default boolean isPrimitive()
- Returns:
- Is the type primitive.
- Since:
- 3.0.0
-
getWrapperType
default java.lang.Class<?> getWrapperType()
If the type is primitive returns the wrapper type, otherwise returns the actual type.- Returns:
- The wrapper type if primitive
-
getTypeName
@NonNull default java.lang.String getTypeName()
- Specified by:
getTypeName
in interfacejava.lang.reflect.Type
-
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 a Optional or a Response wrapper.- Returns:
- True if it is a wrapper type.
- Since:
- 2.4.0
-
getWrappedType
default Argument<?> getWrappedType()
Returns the wrapped type in the case whereisWrapperType()
returns true.- Returns:
- The wrapped type
-
isCompletable
default boolean isCompletable()
- Returns:
- Is the return 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
default java.lang.String getTypeString(boolean simple)
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
@NonNull default java.lang.reflect.Type asType()
Represent this argument as aType
.- Returns:
- The
Type
- Since:
- 3.5.2
-
asParameterizedType
@NonNull default java.lang.reflect.ParameterizedType 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
@NonNull default java.lang.String getSimpleName()
Obtains the type's simple name.- Returns:
- The simple name
- Since:
- 3.0.0
-
isProvider
default boolean isProvider()
-
-