Interface Argument<T>

    • Field Detail

      • STRING

        static final Argument<java.lang.String> STRING
        Constant for string argument.
      • INT

        static final Argument<java.lang.Integer> INT
        Constant for int argument. Used by generated code, do not remove.
      • LONG

        static final Argument<java.lang.Long> LONG
        Constant for long argument. Used by generated code, do not remove.
      • FLOAT

        static final Argument<java.lang.Float> FLOAT
        Constant for float argument. Used by generated code, do not remove.
      • DOUBLE

        static final Argument<java.lang.Double> DOUBLE
        Constant for double argument. Used by generated code, do not remove.
      • VOID

        static final Argument<java.lang.Void> VOID
        Constant for void argument. Used by generated code, do not remove.
      • BYTE

        static final Argument<java.lang.Byte> BYTE
        Constant for byte argument. Used by generated code, do not remove.
      • BOOLEAN

        static final Argument<java.lang.Boolean> BOOLEAN
        Constant for boolean argument. Used by generated code, do not remove.
      • CHAR

        static final Argument<java.lang.Character> CHAR
        Constant char argument. Used by generated code, do not remove.
      • SHORT

        static final Argument<java.lang.Short> SHORT
        Constant short argument. Used by generated code, do not remove.
      • ZERO_ARGUMENTS

        static final Argument[] ZERO_ARGUMENTS
        Constant representing zero arguments. Used by generated code, do not remove.
      • OBJECT_ARGUMENT

        static final Argument<java.lang.Object> OBJECT_ARGUMENT
        Default Object argument. Used by generated code, do not remove.
      • LIST_OF_STRING

        static final Argument<java.util.List<java.lang.String>> LIST_OF_STRING
        Constant for List<String> argument.
      • VOID_OBJECT

        static final Argument<java.lang.Void> VOID_OBJECT
        Constant for Void object argument.
    • Method Detail

      • getName

        @NonNull
        java.lang.String getName()
        Specified by:
        getName in interface Named
        Returns:
        The name of the argument
      • equalsType

        boolean equalsType​(@Nullable
                           Argument<?> other)
        Whether the types are equivalent. The regular Object.equals(Object) implementation includes the argument name within the comparison so this method offers a variation that just compares types.
        Parameters:
        other - The type type
        Returns:
        True if they are equal
      • typeHashCode

        int typeHashCode()
        The hash code including only the types. The regular Object.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

        default boolean isInstance​(@Nullable
                                   java.lang.Object o)
        Whether the given argument is an instance.
        Parameters:
        o - The object
        Returns:
        True if it is an instance of this type
      • isAssignableFrom

        default boolean isAssignableFrom​(@NonNull
                                         java.lang.Class<?> candidateType)
        Delegates to Class.isAssignableFrom(Class) for this argument.
        Parameters:
        candidateType - The candidate type
        Returns:
        True if it is assignable from.
        Since:
        3.0.0
      • isAssignableFrom

        default boolean isAssignableFrom​(@NonNull
                                         Argument<?> candidateArgument)
        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
      • toClassArray

        @NonNull
        static java.lang.Class<?>[] toClassArray​(@Nullable
                                                 Argument<?>... arguments)
        Convert an argument array to a class array.
        Parameters:
        arguments - The arguments
        Returns:
        The class array
      • toString

        @NonNull
        static java.lang.String toString​(@Nullable
                                         Argument<?>... arguments)
        Convert the arguments to a string representation.
        Parameters:
        arguments - The arguments
        Returns:
        The String representation
      • of

        @NonNull
        static <T> Argument<T> of​(@NonNull
                                  java.lang.Class<T> type,
                                  @Nullable
                                  java.lang.String name,
                                  @Nullable
                                  Argument<?>... typeParameters)
        Creates a new argument for the given type and name.
        Type Parameters:
        T - The generic type
        Parameters:
        type - The type
        name - The name
        typeParameters - the type parameters
        Returns:
        The argument instance
      • ofTypeVariable

        @NonNull
        static <T> Argument<T> ofTypeVariable​(@NonNull
                                              java.lang.Class<T> type,
                                              @Nullable
                                              java.lang.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 type
        name - The name
        annotationMetadata - The annotation metadata
        typeParameters - the type parameters
        Returns:
        The argument instance
        Since:
        3.0.0
      • ofTypeVariable

        @NonNull
        static <T> Argument<T> ofTypeVariable​(@NonNull
                                              java.lang.Class<T> type,
                                              @Nullable
                                              java.lang.String argumentName,
                                              @NonNull
                                              java.lang.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 type
        argumentName - The name of the argumennt
        variableName - The variable name
        annotationMetadata - The annotation metadata
        typeParameters - the type parameters
        Returns:
        The argument instance
        Since:
        3.2.0
      • ofTypeVariable

        @NonNull
        static <T> Argument<T> ofTypeVariable​(@NonNull
                                              java.lang.Class<T> type,
                                              @Nullable
                                              java.lang.String name)
        Creates a new argument for the given type and name that is a type variable.
        Type Parameters:
        T - The generic type
        Parameters:
        type - The type
        name - The name
        Returns:
        The argument instance
        Since:
        3.0.0
      • ofTypeVariable

        @NonNull
        static <T> Argument<T> ofTypeVariable​(@NonNull
                                              java.lang.Class<T> type,
                                              @Nullable
                                              java.lang.String argumentName,
                                              @NonNull
                                              java.lang.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 type
        argumentName - The name of the argument
        variableName - The variable name
        Returns:
        The argument instance
        Since:
        3.2.0
      • of

        @NonNull
        static <T> Argument<T> of​(@NonNull
                                  java.lang.Class<T> type,
                                  @Nullable
                                  java.lang.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 type
        name - The name
        annotationMetadata - the annotation metadata
        typeParameters - the type parameters
        Returns:
        The argument instance
      • of

        @NonNull
        static <T> Argument<T> of​(@NonNull
                                  java.lang.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 type
        annotationMetadata - the annotation metadata
        typeParameters - the type parameters
        Returns:
        The argument instance
      • of

        @NonNull
        static <T> Argument<T> of​(@NonNull
                                  java.lang.Class<T> type,
                                  @Nullable
                                  java.lang.String name)
        Creates a new argument for the given type and name.
        Type Parameters:
        T - The generic type
        Parameters:
        type - The type
        name - The name
        Returns:
        The argument instance
      • of

        @NonNull
        static <T> Argument<T> of​(@NonNull
                                  java.lang.Class<T> type,
                                  @Nullable
                                  Argument<?>... typeParameters)
        Creates a new argument for the given type and name.
        Type Parameters:
        T - The generic type
        Parameters:
        type - The type
        typeParameters - The parameters type
        Returns:
        The argument instance
      • of

        @NonNull
        static Argument<?> of​(@NonNull
                              java.lang.reflect.Type type)
        Allows coercing a Type instance to an Argument.
        Parameters:
        type - The type
        Returns:
        The argument
        Throws:
        java.lang.IllegalArgumentException - If the type cannot be coerced
        Since:
        3.0.0
      • of

        @NonNull
        static <T> Argument<T> of​(@NonNull
                                  java.lang.Class<T> type)
        Creates a new argument for the given type and name.
        Type Parameters:
        T - The generic type
        Parameters:
        type - The type
        Returns:
        The argument instance
      • of

        @NonNull
        static <T> Argument<T> of​(@NonNull
                                  java.lang.Class<T> type,
                                  @Nullable
                                  java.lang.Class<?>... typeParameters)
        Creates a new argument for the given type and name.
        Type Parameters:
        T - The generic type
        Parameters:
        type - The type
        typeParameters - the parameters type
        Returns:
        The argument instance
      • of

        @NonNull
        static <T> Argument<T> of​(@NonNull
                                  java.lang.Class<T> type,
                                  @Nullable
                                  AnnotationMetadata annotationMetadata,
                                  @Nullable
                                  java.lang.Class<?>[] typeParameters)
        Creates a new argument for the given type and name.
        Type Parameters:
        T - The generic type
        Parameters:
        type - The type
        annotationMetadata - The annotation metadata
        typeParameters - The parameters type
        Returns:
        The argument instance
        Since:
        3.0.0
      • listOf

        @NonNull
        static <T> Argument<java.util.List<T>> listOf​(@NonNull
                                                      java.lang.Class<T> type)
        Creates a new argument representing a generic list.
        Type Parameters:
        T - list element type
        Parameters:
        type - list element type
        Returns:
        The argument instance
      • listOf

        @NonNull
        static <T> Argument<java.util.List<T>> listOf​(@NonNull
                                                      Argument<T> type)
        Creates a new argument representing a generic list.
        Type Parameters:
        T - list element type
        Parameters:
        type - list element type
        Returns:
        The argument instance
        Since:
        2.0.1
      • setOf

        @NonNull
        static <T> Argument<java.util.Set<T>> setOf​(@NonNull
                                                    java.lang.Class<T> type)
        Creates a new argument representing a generic set.
        Type Parameters:
        T - set element type
        Parameters:
        type - set element type
        Returns:
        The argument instance
      • setOf

        @NonNull
        static <T> Argument<java.util.Set<T>> setOf​(@NonNull
                                                    Argument<T> type)
        Creates a new argument representing a generic set.
        Type Parameters:
        T - set element type
        Parameters:
        type - set element type
        Returns:
        The argument instance
        Since:
        2.0.1
      • mapOf

        @NonNull
        static <K,​V> Argument<java.util.Map<K,​V>> mapOf​(@NonNull
                                                                    java.lang.Class<K> keyType,
                                                                    @NonNull
                                                                    java.lang.Class<V> valueType)
        Creates a new argument representing a generic map.
        Type Parameters:
        K - The map key type
        V - The map value type
        Parameters:
        keyType - The key type
        valueType - The value type
        Returns:
        The argument instance
      • mapOf

        @NonNull
        static <K,​V> Argument<java.util.Map<K,​V>> mapOf​(@NonNull
                                                                    Argument<K> keyType,
                                                                    @NonNull
                                                                    Argument<V> valueType)
        Creates a new argument representing a generic map.
        Type Parameters:
        K - The map key type
        V - The map value type
        Parameters:
        keyType - The key type
        valueType - The value type
        Returns:
        The argument instance
        Since:
        2.0.1