Interface Argument<T>
- Type Parameters:
T- The argument type
- All Superinterfaces:
AnnotatedElement, AnnotationMetadataProvider, AnnotationSource, Named, Type, TypeInformation<T>, TypeVariableResolver
- All Known Subinterfaces:
ArgumentValue<V>, GenericPlaceholder<T>, MutableArgumentValue<V>
- All Known Implementing Classes:
ArgumentBeanType, DefaultArgument, GenericArgument
Represents an argument to a method or constructor or type.
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Nested Class Summary
Nested classes/interfaces inherited from interface TypeInformation
TypeInformation.TypeFormat -
Field Summary
FieldsModifier and TypeFieldDescriptionConstant for boolean argument.Constant for byte argument.Constant char argument.Constant for double argument.Constant for float argument.Constant for int argument.Constant forList<String>argument.Constant for long argument.Default Object argument.Constant short argument.Constant for string argument.Constant for void argument.Constant for Void object argument.static final Argument[]Constant representing zero arguments.Fields inherited from interface AnnotationSource
EMPTY -
Method Summary
Modifier and TypeMethodDescriptionbooleanequalsType(@Nullable Argument<?> other) Whether the types are equivalent.getName()default booleanisAssignableFrom(Argument<?> candidateArgument) Checks if the argument can be assigned to this argument.default booleanisAssignableFrom(Class<?> candidateType) Delegates toClass.isAssignableFrom(Class)for this argument.default booleanisInstance(@Nullable Object o) Whether the given argument is an instance.default booleanWhether this argument is a type variable used in generics.Creates a new argument representing a generic list.Creates a new argument representing a generic list.Creates a new argument representing a generic map.Creates a new argument representing a generic map.static <T> Argument<T> Creates a new argument for the given type and name.static <T> Argument<T> of(Class<T> type, @Nullable AnnotationMetadata annotationMetadata, @Nullable Argument<?>... typeParameters) Creates a new argument for the given type and name.static <T> Argument<T> of(Class<T> type, @Nullable AnnotationMetadata annotationMetadata, Class<?> @Nullable [] typeParameters) Creates a new argument for the given type and name.static <T> Argument<T> Creates a new argument for the given type and name.static <T> Argument<T> Creates a new argument for the given type and name.static <T> Argument<T> Creates a new argument for the given type and name.static <T> Argument<T> of(Class<T> type, @Nullable String name, @Nullable AnnotationMetadata annotationMetadata, @Nullable Argument<?>... typeParameters) Creates a new argument for the given type and name.static <T> Argument<T> Creates a new argument for the given type and name.static Argument<?> static <T> Argument<T> ofInstance(T instance) Creates a new argument for the type of the given instance.static <T> Argument<T> ofTypeVariable(Class<T> type, @Nullable String name) Creates a new argument for the given type and name that is a type variable.static <T> Argument<T> ofTypeVariable(Class<T> type, @Nullable String name, @Nullable AnnotationMetadata annotationMetadata, @Nullable Argument<?>... typeParameters) Creates a new argument for the given type and name that is a type variable.static <T> Argument<T> ofTypeVariable(Class<T> type, @Nullable String argumentName, String variableName) Creates a new argument for the given type and name that is a type variable.static <T> Argument<T> ofTypeVariable(Class<T> type, @Nullable String argumentName, String variableName, @Nullable AnnotationMetadata annotationMetadata, @Nullable Argument<?>... typeParameters) Creates a new argument for the given type and name that is a type variable.optionalOf(Argument<T> optionalValueArgument) Creates a new argument representing an optional.optionalOf(Class<T> optionalValueClass) Creates a new argument representing an optional.Creates a new argument representing a generic set.Creates a new argument representing a generic set.static Class<?>[]toClassArray(Argument<?> @Nullable ... arguments) Convert an argument array to a class array.static StringConvert the arguments to a string representation.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, getAnnotationMetadata, getTargetAnnotationMetadata, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByTypeMethods inherited from interface AnnotationSource
getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeDeclaredMethods inherited from interface TypeInformation
asParameterizedType, asType, getBeanTypeString, getSimpleName, getType, getTypeName, getTypeString, getTypeString, getWrappedType, getWrapperType, hasTypeVariables, isArray, isAsync, isAsyncOrReactive, isCompletable, isContainerType, isOptional, isPrimitive, isProvider, isReactive, isSpecifiedSingle, isVoid, isWrapperTypeMethods inherited from interface TypeVariableResolver
getFirstTypeVariable, getTypeParameters, getTypeVariable, getTypeVariables
-
Field Details
-
STRING
-
INT
-
LONG
-
FLOAT
-
DOUBLE
-
VOID
-
BYTE
-
BOOLEAN
-
CHAR
-
SHORT
-
ZERO_ARGUMENTS
Constant representing zero arguments. Used by generated code, do not remove. -
OBJECT_ARGUMENT
-
LIST_OF_STRING
-
VOID_OBJECT
-
-
Method Details
-
getName
-
equalsType
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.- Parameters:
other- The type- Returns:
- True if they are equal
-
typeHashCode
int typeHashCode()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.- Returns:
- The type hash code
-
isTypeVariable
default boolean isTypeVariable()Whether this argument is a type variable used in generics.- Returns:
- True if it is a variable
- Since:
- 3.0.0
-
isInstance
Whether the given argument is an instance.- Parameters:
o- The object- Returns:
- True if it is an instance of this type
-
isAssignableFrom
Delegates toClass.isAssignableFrom(Class)for this argument.- Parameters:
candidateType- The candidate type- Returns:
- True if it is assignable from.
- Since:
- 3.0.0
-
isAssignableFrom
Checks if the argument can be assigned to this argument.- Parameters:
candidateArgument- The candidate argument- Returns:
- True if it is assignable from.
- Since:
- 3.0.0
-
withName
-
withAnnotationMetadata
Creates a copy of this argument with a different annotation metadata.- Parameters:
annotationMetadata- The annotation metadata- Returns:
- A new argument
- Since:
- 4.6
-
toClassArray
-
toString
-
of
static <T> Argument<T> of(Class<T> type, @Nullable String name, Argument<?> @Nullable ... typeParameters) Creates a new argument for the given type and name.- Type Parameters:
T- The generic type- Parameters:
type- The typename- The nametypeParameters- the type parameters- Returns:
- The argument instance
-
ofTypeVariable
static <T> Argument<T> ofTypeVariable(Class<T> type, @Nullable String name, @Nullable AnnotationMetadata annotationMetadata, @Nullable Argument<?>... typeParameters) Creates a new argument for the given type and name that is a type variable.- Type Parameters:
T- The generic type- Parameters:
type- The typename- The nameannotationMetadata- The annotation metadatatypeParameters- the type parameters- Returns:
- The argument instance
- Since:
- 3.0.0
-
ofTypeVariable
static <T> Argument<T> ofTypeVariable(Class<T> type, @Nullable String argumentName, String variableName, @Nullable AnnotationMetadata annotationMetadata, @Nullable Argument<?>... typeParameters) Creates a new argument for the given type and name that is a type variable.- Type Parameters:
T- The generic type- Parameters:
type- The typeargumentName- The name of the argumenntvariableName- The variable nameannotationMetadata- The annotation metadatatypeParameters- the type parameters- Returns:
- The argument instance
- Since:
- 3.2.0
-
ofTypeVariable
-
ofTypeVariable
static <T> Argument<T> ofTypeVariable(Class<T> type, @Nullable String argumentName, String variableName) Creates a new argument for the given type and name that is a type variable.- Type Parameters:
T- The generic type- Parameters:
type- The typeargumentName- The name of the argumentvariableName- The variable name- Returns:
- The argument instance
- Since:
- 3.2.0
-
of
static <T> Argument<T> of(Class<T> type, @Nullable String name, @Nullable AnnotationMetadata annotationMetadata, @Nullable Argument<?>... typeParameters) Creates a new argument for the given type and name.- Type Parameters:
T- The generic type- Parameters:
type- The typename- The nameannotationMetadata- the annotation metadatatypeParameters- the type parameters- Returns:
- The argument instance
-
of
static <T> Argument<T> of(Class<T> type, @Nullable AnnotationMetadata annotationMetadata, @Nullable Argument<?>... typeParameters) Creates a new argument for the given type and name.- Type Parameters:
T- The generic type- Parameters:
type- The typeannotationMetadata- the annotation metadatatypeParameters- the type parameters- Returns:
- The argument instance
-
of
-
of
-
of
- Parameters:
type- The type- Returns:
- The argument
- Throws:
IllegalArgumentException- If the type cannot be coerced- Since:
- 3.0.0
-
of
-
ofInstance
Creates a new argument for the type of the given instance.- Type Parameters:
T- The generic type- Parameters:
instance- The argument instance- Returns:
- The argument instance
- Since:
- 4.6
-
of
-
of
static <T> Argument<T> of(Class<T> type, @Nullable AnnotationMetadata annotationMetadata, Class<?> @Nullable [] typeParameters) Creates a new argument for the given type and name. NOTE: This method should be avoided as it does use the reflection to retrieve the type parameter names.- Type Parameters:
T- The generic type- Parameters:
type- The typeannotationMetadata- The annotation metadatatypeParameters- The parameters type- Returns:
- The argument instance
- Since:
- 3.0.0
-
listOf
-
listOf
-
setOf
-
setOf
-
mapOf
-
mapOf
-
optionalOf
-
optionalOf
-