Class ChainedParamReader


  • public class ChainedParamReader
    extends Object
    Description: In ParamReader class, user cannot get inherited method parameter from the class they passed in for performance reasons This class is walks up the inheritance chain. If the method is not found in the derived class, search in super class. If not found in the immedidate super class, search super class's super class, until the root, which is java.lang.Object, is reached. This is not an eager load since it only start searching the super class when it is asked to.
    • Constructor Detail

      • ChainedParamReader

        public ChainedParamReader​(Class cls)
                           throws IOException
        Processes a given class's parameter names.
        Parameters:
        cls - the class which user wants to get parameter info from
        Throws:
        IOException
    • Method Detail

      • getParameterNames

        public String[] getParameterNames​(Constructor ctor)
        Returns the names of the declared parameters for the given constructor. If we cannot determine the names, return null. The returned array will have one name per parameter. The length of the array will be the same as the length of the Class[] array returned by Constructor.getParameterTypes().
        Parameters:
        ctor -
        Returns:
        Returns array of names, one per parameter, or null
      • getParameterNames

        public String[] getParameterNames​(Method method)
        Returns the names of the declared parameters for the given method. If cannot determine the names in the current class, search its parent class until we reach java.lang.Object. If still can not find the method, returns null. The returned array has one name per parameter. The length of the array will be the same as the length of the Class[] array returned by Method.getParameterTypes().
        Parameters:
        method -
        Returns:
        String[] Returns array of names, one per parameter, or null