Package io.micronaut.core.type
Class DefaultArgument<T>
java.lang.Object
io.micronaut.core.type.DefaultArgument<T>
- Type Parameters:
T
- The argument type
- All Implemented Interfaces:
AnnotatedElement
,AnnotationMetadataProvider
,AnnotationSource
,Named
,Argument<T>
,ArgumentCoercible<T>
,TypeInformation<T>
,TypeVariableResolver
,Type
- Direct Known Subclasses:
GenericArgument
@Internal
public class DefaultArgument<T>
extends Object
implements Argument<T>, ArgumentCoercible<T>
Represents an argument to a constructor or method.
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
Modifier and TypeFieldDescriptionFields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTY
Fields inherited from interface io.micronaut.core.type.Argument
BOOLEAN, BYTE, CHAR, DOUBLE, FLOAT, INT, LIST_OF_STRING, LONG, OBJECT_ARGUMENT, SHORT, STRING, VOID, VOID_OBJECT, ZERO_ARGUMENTS
-
Constructor Summary
ModifierConstructorDescriptionDefaultArgument
(Class<T> type, AnnotationMetadata annotationMetadata, Argument<?>... genericTypes) DefaultArgument
(Class<T> type, String name, AnnotationMetadata annotationMetadata, boolean isTypeVariable, Argument<?>... genericTypes) DefaultArgument
(Class<T> type, String name, AnnotationMetadata annotationMetadata, Argument<?>... genericTypes) DefaultArgument
(Class<T> type, String name, AnnotationMetadata annotationMetadata, Map<String, Argument<?>> typeParameters, Argument<?>[] typeParameterArray) protected
DefaultArgument
(Class<T> type, String name, AnnotationMetadata annotationMetadata, Map<String, Argument<?>> typeParameters, Argument<?>[] typeParameterArray, boolean isTypeVariable) DefaultArgument
(Type type, String name, AnnotationMetadata annotationMetadata) -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
equalsType
(@Nullable Argument<?> o) Whether the types are equivalent.Supplies the metadata.getName()
getType()
Argument[]
int
hashCode()
boolean
boolean
Whether this argument is a type variable used in generics.toString()
int
The hash code including only the types.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.micronaut.core.annotation.AnnotatedElement
isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullable
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider
findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, 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.Argument
isAssignableFrom, isAssignableFrom, isInstance
Methods inherited from interface io.micronaut.core.type.TypeInformation
asParameterizedType, asType, getSimpleName, getTypeName, getTypeString, getWrappedType, getWrapperType, hasTypeVariables, isArray, isAsync, isAsyncOrReactive, isCompletable, isContainerType, isOptional, isPrimitive, isProvider, isSpecifiedSingle, isVoid, isWrapperType
Methods inherited from interface io.micronaut.core.type.TypeVariableResolver
getTypeVariable
-
Field Details
-
CONTAINER_TYPES
-
PROVIDER_TYPES
-
-
Constructor Details
-
DefaultArgument
public DefaultArgument(Class<T> type, String name, AnnotationMetadata annotationMetadata, Argument<?>... genericTypes) - Parameters:
type
- The typename
- The nameannotationMetadata
- The annotation metadatagenericTypes
- The generic types
-
DefaultArgument
public DefaultArgument(Class<T> type, AnnotationMetadata annotationMetadata, Argument<?>... genericTypes) - Parameters:
type
- The typeannotationMetadata
- The annotation metadatagenericTypes
- The generic types
-
DefaultArgument
public DefaultArgument(Class<T> type, String name, AnnotationMetadata annotationMetadata, Map<String, Argument<?>> typeParameters, Argument<?>[] typeParameterArray) - Parameters:
type
- The typename
- The nameannotationMetadata
- The annotation metadatatypeParameters
- The map of parameterstypeParameterArray
- The array of arguments
-
DefaultArgument
public DefaultArgument(Class<T> type, String name, AnnotationMetadata annotationMetadata, boolean isTypeVariable, Argument<?>... genericTypes) - Parameters:
type
- The typename
- The nameannotationMetadata
- The annotation metadataisTypeVariable
- Is this argument a type variablegenericTypes
- The generic types
-
DefaultArgument
protected DefaultArgument(Class<T> type, String name, AnnotationMetadata annotationMetadata, Map<String, Argument<?>> typeParameters, Argument<?>[] typeParameterArray, boolean isTypeVariable) - Parameters:
type
- The typename
- The nameannotationMetadata
- The annotation metadatatypeParameters
- The map of parameterstypeParameterArray
- The array of argumentsisTypeVariable
- Is the argument a type variable
-
DefaultArgument
- Parameters:
type
- The typename
- The nameannotationMetadata
- The annotation metadata
-
-
Method Details
-
isTypeVariable
public boolean isTypeVariable()Description copied from interface:Argument
Whether this argument is a type variable used in generics.- Specified by:
isTypeVariable
in interfaceArgument<T>
- Returns:
- True if it is a variable
-
getAnnotationMetadata
Description copied from interface:AnnotationMetadataProvider
Supplies the metadata. Defaults toAnnotationMetadata.EMPTY_METADATA
.- Specified by:
getAnnotationMetadata
in interfaceAnnotationMetadataProvider
- Returns:
- The
AnnotationMetadata
-
getFirstTypeVariable
- Specified by:
getFirstTypeVariable
in interfaceTypeVariableResolver
- Returns:
- Return the first type parameter if it is present
-
getTypeParameters
- Specified by:
getTypeParameters
in interfaceTypeVariableResolver
- Returns:
- The type parameters as an array
-
getTypeVariables
- Specified by:
getTypeVariables
in interfaceTypeVariableResolver
- Returns:
- Obtain a map of the type parameters for the argument
-
getType
- Specified by:
getType
in interfaceTypeInformation<T>
- Returns:
- The type
-
isReactive
public boolean isReactive()- Specified by:
isReactive
in interfaceTypeInformation<T>
- Returns:
- Is the return type reactive.
-
getName
-
toString
-
equalsType
Description copied from interface:Argument
Whether the types are equivalent. The regularObject.equals(Object)
implementation includes the argument name within the comparison so this method offers a variation that just compares types.- Specified by:
equalsType
in interfaceArgument<T>
- Parameters:
o
- The type type- Returns:
- True if they are equal
-
equals
-
typeHashCode
public int typeHashCode()Description copied from interface:Argument
The hash code including only the types. The regularObject.hashCode()
implementation includes the argument name within the comparison so this method offers a variation that just compares types.- Specified by:
typeHashCode
in interfaceArgument<T>
- Returns:
- The type hash code
-
hashCode
public int hashCode() -
asArgument
- Specified by:
asArgument
in interfaceArgumentCoercible<T>
- Returns:
- The argument
-