@Internal
public class TypeUtils
extends java.lang.Object
Constructor and Description |
---|
TypeUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
areTypesCompatible(io.micronaut.inject.ast.ClassElement leftType,
io.micronaut.inject.ast.ClassElement rightType)
Return true if the left type is compatible or can be assigned to the right type.
|
static boolean |
doesReturnBoolean(io.micronaut.inject.ast.MethodElement methodElement)
Does the given method element return boolean.
|
static boolean |
doesReturnNumber(io.micronaut.inject.ast.MethodElement methodElement)
Does the method return an object convertible to a number.
|
static boolean |
doesReturnVoid(io.micronaut.inject.ast.MethodElement methodElement)
Does the method element return void.
|
static java.lang.String |
getTypeName(io.micronaut.inject.ast.ClassElement type)
Return the type for the given class element, wrapping primitives types if necessary.
|
static boolean |
hasPersistedTypeArgument(io.micronaut.inject.ast.ClassElement type)
Does the given type have a first argument annotated with
MappedEntity . |
static boolean |
isBoolean(io.micronaut.inject.ast.ClassElement type)
Is the type a boolean.
|
static boolean |
isContainerType(io.micronaut.inject.ast.ClassElement type)
Is the type a container type such as a collection etc.
|
static boolean |
isEntityContainerType(io.micronaut.inject.ast.ClassElement type)
Is the given type a container type of entity.
|
static boolean |
isFutureType(io.micronaut.inject.ast.ClassElement type)
Is the type a future type.
|
static boolean |
isIterableOfEntity(io.micronaut.inject.ast.ClassElement type)
Is the element an iterable of an entity.
|
static boolean |
isNumber(io.micronaut.inject.ast.ClassElement type)
Is the type a number.
|
static boolean |
isObjectClass(io.micronaut.inject.ast.ClassElement type)
Whether the given type is Object.
|
static boolean |
isReactiveOrFuture(io.micronaut.inject.ast.ClassElement type)
Is the type a future type.
|
static boolean |
isReactiveType(io.micronaut.inject.ast.ClassElement type)
Is the type a reactive type.
|
static boolean |
isVoid(io.micronaut.inject.ast.ClassElement type)
Is the type void.
|
static boolean |
isVoidOrNumberArgument(io.micronaut.inject.ast.ClassElement type)
Retruns true if no type argument is present, a void argument is present or a boolean argument is present.
|
static DataType |
resolveDataType(io.micronaut.inject.ast.ClassElement type,
java.util.Map<java.lang.String,DataType> dataTypes)
Compute the data type for the given type.
|
public static boolean isIterableOfEntity(@Nullable io.micronaut.inject.ast.ClassElement type)
type
- The typepublic static boolean isEntityContainerType(@Nullable io.micronaut.inject.ast.ClassElement type)
type
- The typepublic static boolean hasPersistedTypeArgument(@Nullable io.micronaut.inject.ast.ClassElement type)
MappedEntity
.type
- The typepublic static boolean doesReturnNumber(@NonNull io.micronaut.inject.ast.MethodElement methodElement)
methodElement
- The method elementpublic static boolean doesReturnVoid(@NonNull io.micronaut.inject.ast.MethodElement methodElement)
methodElement
- The method elementpublic static boolean doesReturnBoolean(@NonNull io.micronaut.inject.ast.MethodElement methodElement)
methodElement
- The method elementpublic static boolean isContainerType(@Nullable io.micronaut.inject.ast.ClassElement type)
type
- The typepublic static boolean isReactiveType(@Nullable io.micronaut.inject.ast.ClassElement type)
type
- The typepublic static boolean isFutureType(@Nullable io.micronaut.inject.ast.ClassElement type)
type
- The typepublic static boolean isReactiveOrFuture(@Nullable io.micronaut.inject.ast.ClassElement type)
type
- The typepublic static boolean isNumber(@Nullable io.micronaut.inject.ast.ClassElement type)
type
- The typepublic static boolean isVoid(@Nullable io.micronaut.inject.ast.ClassElement type)
type
- The typepublic static boolean isBoolean(@Nullable io.micronaut.inject.ast.ClassElement type)
type
- The typepublic static boolean isVoidOrNumberArgument(io.micronaut.inject.ast.ClassElement type)
type
- The typepublic static boolean isObjectClass(io.micronaut.inject.ast.ClassElement type)
type
- The type@NonNull public static DataType resolveDataType(@NonNull io.micronaut.inject.ast.ClassElement type, java.util.Map<java.lang.String,DataType> dataTypes)
type
- The typedataTypes
- Configured data typespublic static boolean areTypesCompatible(io.micronaut.inject.ast.ClassElement leftType, io.micronaut.inject.ast.ClassElement rightType)
leftType
- The left typerightType
- The right type@NonNull public static java.lang.String getTypeName(@NonNull io.micronaut.inject.ast.ClassElement type)
type
- The type