Class MethodArgument

  • All Implemented Interfaces:
    java.lang.reflect.AnnotatedElement

    public final class MethodArgument
    extends java.lang.Object
    implements java.lang.reflect.AnnotatedElement
    Class to supply the missing Java AnnotatedElement for method arguments.
    Since:
    2.1
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.annotation.Annotation[] annotations
      The method argument annotations.
      private int index
      The method argument index.
      private java.lang.Class<?> parameterType
      The method argument type.
    • Constructor Summary

      Constructors 
      Constructor Description
      MethodArgument​(int index, java.lang.Class<?> parameterType, java.lang.annotation.Annotation[] annotations)
      Creates a new method argument as AnnotatedElement.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T extends java.lang.annotation.Annotation>
      T
      getAnnotation​(java.lang.Class<T> annotationType)
      java.lang.annotation.Annotation[] getAnnotations()
      private java.lang.annotation.Annotation[] getAnnotationsArrayCopy()
      Returns an annotations array, copy of the declared annotations in this method argument.
      java.lang.annotation.Annotation[] getDeclaredAnnotations()
      int getIndex()
      Returns the method argument index.
      java.lang.Class<?> getParameterType()
      Returns the method argument type.
      boolean isAnnotationPresent​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.reflect.AnnotatedElement

        getAnnotationsByType, getDeclaredAnnotation, getDeclaredAnnotationsByType
    • Field Detail

      • index

        private final int index
        The method argument index.
      • parameterType

        private final java.lang.Class<?> parameterType
        The method argument type.
      • annotations

        private final java.lang.annotation.Annotation[] annotations
        The method argument annotations.
    • Constructor Detail

      • MethodArgument

        public MethodArgument​(int index,
                              java.lang.Class<?> parameterType,
                              java.lang.annotation.Annotation[] annotations)
        Creates a new method argument as AnnotatedElement.
        Parameters:
        index - the method argument index.
        parameterType - the method argument type.
        annotations - the method argument annotations.
    • Method Detail

      • getIndex

        public int getIndex()
        Returns the method argument index.
        Returns:
        the method argument index.
      • getParameterType

        public java.lang.Class<?> getParameterType()
        Returns the method argument type.
        Returns:
        the method argument type.
      • getAnnotation

        public <T extends java.lang.annotation.Annotation> T getAnnotation​(java.lang.Class<T> annotationType)
        Specified by:
        getAnnotation in interface java.lang.reflect.AnnotatedElement
      • getAnnotations

        public java.lang.annotation.Annotation[] getAnnotations()
        Specified by:
        getAnnotations in interface java.lang.reflect.AnnotatedElement
      • getDeclaredAnnotations

        public java.lang.annotation.Annotation[] getDeclaredAnnotations()
        Specified by:
        getDeclaredAnnotations in interface java.lang.reflect.AnnotatedElement
      • getAnnotationsArrayCopy

        private java.lang.annotation.Annotation[] getAnnotationsArrayCopy()
        Returns an annotations array, copy of the declared annotations in this method argument.
        Returns:
        an annotations array, copy of the declared annotations in this method argument.
      • isAnnotationPresent

        public boolean isAnnotationPresent​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
        Specified by:
        isAnnotationPresent in interface java.lang.reflect.AnnotatedElement