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
-
Nested Class Summary
Nested classes/interfaces inherited from interface TypeInformation
TypeInformation.TypeFormat -
Field Summary
FieldsModifier and TypeFieldDescriptionFields inherited from interface AnnotationSource
EMPTYFields inherited from interface Argument
BOOLEAN, BYTE, CHAR, DOUBLE, FLOAT, INT, LIST_OF_STRING, LONG, OBJECT_ARGUMENT, SHORT, STRING, VOID, VOID_OBJECT, ZERO_ARGUMENTS -
Constructor Summary
ConstructorsModifierConstructorDescriptionDefaultArgument(Class<T> type, @Nullable AnnotationMetadata annotationMetadata, Argument<?> @Nullable ... genericTypes) DefaultArgument(Class<T> type, @Nullable String name, @Nullable AnnotationMetadata annotationMetadata, boolean isTypeVariable, Argument<?> @Nullable ... genericTypes) DefaultArgument(Class<T> type, @Nullable String name, @Nullable AnnotationMetadata annotationMetadata, Argument<?> @Nullable ... genericTypes) DefaultArgument(Class<T> type, @Nullable String name, @Nullable AnnotationMetadata annotationMetadata, Map<String, Argument<?>> typeParameters, Argument<?> @Nullable [] typeParameterArray) protectedDefaultArgument(Class<T> type, @Nullable String name, @Nullable AnnotationMetadata annotationMetadata, Map<String, Argument<?>> typeParameters, Argument<?> @Nullable [] typeParameterArray, boolean isTypeVariable) DefaultArgument(@Nullable Type type, @Nullable String name, @Nullable AnnotationMetadata annotationMetadata) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanequalsType(@Nullable Argument<?> o) Whether the types are equivalent.Supplies the metadata.getName()getType()Argument<?>[]inthashCode()booleanbooleanWhether this argument is a type variable used in generics.toString()intThe hash code including only the types.withAnnotationMetadata(AnnotationMetadata annotationMetadata) Creates a copy of this argument with a different annotation metadata.Creates a copy of this argument with a different name.Methods inherited from interface AnnotatedElement
isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullableMethods inherited from interface AnnotationMetadataProvider
findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, getTargetAnnotationMetadata, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByTypeMethods inherited from interface AnnotationSource
getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeDeclaredMethods inherited from interface Argument
isAssignableFrom, isAssignableFrom, isInstanceMethods inherited from interface TypeInformation
asParameterizedType, asType, getBeanTypeString, getSimpleName, getTypeName, getTypeString, getTypeString, getWrappedType, getWrapperType, hasTypeVariables, isArray, isAsync, isAsyncOrReactive, isCompletable, isContainerType, isOptional, isPrimitive, isProvider, isSpecifiedSingle, isVoid, isWrapperTypeMethods inherited from interface TypeVariableResolver
getTypeVariable
-
Field Details
-
CONTAINER_TYPES
-
PROVIDER_TYPES
-
-
Constructor Details
-
DefaultArgument
public DefaultArgument(Class<T> type, @Nullable String name, @Nullable AnnotationMetadata annotationMetadata, Argument<?> @Nullable ... genericTypes) - Parameters:
type- The typename- The nameannotationMetadata- The annotation metadatagenericTypes- The generic types
-
DefaultArgument
public DefaultArgument(Class<T> type, @Nullable AnnotationMetadata annotationMetadata, Argument<?> @Nullable ... genericTypes) - Parameters:
type- The typeannotationMetadata- The annotation metadatagenericTypes- The generic types
-
DefaultArgument
public DefaultArgument(Class<T> type, @Nullable String name, @Nullable AnnotationMetadata annotationMetadata, Map<String, Argument<?>> typeParameters, Argument<?> @Nullable [] typeParameterArray) - Parameters:
type- The typename- The nameannotationMetadata- The annotation metadatatypeParameters- The map of parameterstypeParameterArray- The array of arguments
-
DefaultArgument
public DefaultArgument(Class<T> type, @Nullable String name, @Nullable AnnotationMetadata annotationMetadata, boolean isTypeVariable, Argument<?> @Nullable ... 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, @Nullable String name, @Nullable AnnotationMetadata annotationMetadata, Map<String, Argument<?>> typeParameters, Argument<?> @Nullable [] 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
public DefaultArgument(@Nullable Type type, @Nullable String name, @Nullable AnnotationMetadata annotationMetadata) - Parameters:
type- The typename- The nameannotationMetadata- The annotation metadata
-
-
Method Details
-
withName
-
withAnnotationMetadata
Description copied from interface:ArgumentCreates a copy of this argument with a different annotation metadata.- Specified by:
withAnnotationMetadatain interfaceArgument<T>- Parameters:
annotationMetadata- The annotation metadata- Returns:
- A new argument
-
isTypeVariable
public boolean isTypeVariable()Description copied from interface:ArgumentWhether this argument is a type variable used in generics.- Specified by:
isTypeVariablein interfaceArgument<T>- Returns:
- True if it is a variable
-
getAnnotationMetadata
Description copied from interface:AnnotationMetadataProviderSupplies the metadata. Defaults toAnnotationMetadata.EMPTY_METADATA.- Specified by:
getAnnotationMetadatain interfaceAnnotationMetadataProvider- Returns:
- The
AnnotationMetadata
-
getFirstTypeVariable
- Specified by:
getFirstTypeVariablein interfaceTypeVariableResolver- Returns:
- Return the first type parameter if it is present
-
getTypeParameters
- Specified by:
getTypeParametersin interfaceTypeVariableResolver- Returns:
- The type parameters as an array
-
getTypeVariables
- Specified by:
getTypeVariablesin interfaceTypeVariableResolver- Returns:
- Obtain a map of the type parameters for the argument
-
getType
- Specified by:
getTypein interfaceTypeInformation<T>- Returns:
- The type
-
isReactive
public boolean isReactive()- Specified by:
isReactivein interfaceTypeInformation<T>- Returns:
- Is the return type reactive.
-
getName
-
toString
-
equalsType
Description copied from interface:ArgumentWhether 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:
equalsTypein interfaceArgument<T>- Parameters:
o- The type- Returns:
- True if they are equal
-
equals
-
typeHashCode
public int typeHashCode()Description copied from interface:ArgumentThe 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:
typeHashCodein interfaceArgument<T>- Returns:
- The type hash code
-
hashCode
-
asArgument
- Specified by:
asArgumentin interfaceArgumentCoercible<T>- Returns:
- The argument
-