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
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.micronaut.core.type.TypeInformation
TypeInformation.TypeFormat -
Field Summary
FieldsModifier and TypeFieldDescriptionFields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTYFields 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
ConstructorsModifierConstructorDescriptionDefaultArgument(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) protectedDefaultArgument(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 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 class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.micronaut.core.annotation.AnnotatedElement
isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullableMethods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider
findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, 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.Argument
isAssignableFrom, isAssignableFrom, isInstanceMethods inherited from interface io.micronaut.core.type.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 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
-
withName
Description copied from interface:ArgumentCreates a copy of this argument with a different name. -
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
public int hashCode() -
asArgument
- Specified by:
asArgumentin interfaceArgumentCoercible<T>- Returns:
- The argument
-