Class DeclaredMemberIndexer


  • public final class DeclaredMemberIndexer
    extends Object
    Author:
    Martin Kouba
    • Method Detail

      • getIndexForField

        public static int getIndexForField​(Field field)
        Parameters:
        field -
        Returns:
        the index for the given field
      • getFieldForIndex

        public static Field getFieldForIndex​(int index,
                                             Class<?> declaringClass)
        Parameters:
        index -
        declaringClass -
        Returns:
        the declared field for the given index and declaring class
        Throws:
        IndexOutOfBoundsException - if the index is out of range
      • getIndexForMethod

        public static int getIndexForMethod​(Method method)
        Parameters:
        method -
        Returns:
        the index for the given method
      • getMethodForIndex

        public static Method getMethodForIndex​(int index,
                                               Class<?> declaringClass)
        Parameters:
        index -
        declaringClass -
        Returns:
        the declared method for the given index and declaring class
        Throws:
        IndexOutOfBoundsException - if the index is out of range
      • getIndexForConstructor

        public static int getIndexForConstructor​(Constructor<?> constructor)
        Parameters:
        constructor -
        Returns:
        the index for the given constructor
      • getConstructorForIndex

        public static <T> Constructor<T> getConstructorForIndex​(int index,
                                                                Class<T> declaringClass)
        Parameters:
        index -
        declaringClass -
        Returns:
        the declared constructor for the given index and declaring class
        Throws:
        IndexOutOfBoundsException - if the index is out of range
      • getDeclaredFields

        public static List<Field> getDeclaredFields​(Class<?> declaringClass)
        Parameters:
        declaringClass -
        Returns:
        the ordered list of declared fields for the given class
      • getDeclaredMethods

        public static List<Method> getDeclaredMethods​(Class<?> declaringClass)
        Parameters:
        declaringClass -
        Returns:
        the ordered list of declared methods for the given class
      • getDeclaredConstructors

        public static List<Constructor<?>> getDeclaredConstructors​(Class<?> declaringClass)
        Parameters:
        declaringClass -
        Returns:
        the ordered list of declared constructors for the given class