Class ApplicationConfigReflectionHelper


  • public class ApplicationConfigReflectionHelper
    extends Object
    Created on 19/12/2021.
    Since:
    1.0.21
    Author:
    Tony Chemit - dev@tchemit.fr
    • Constructor Detail

      • ApplicationConfigReflectionHelper

        public ApplicationConfigReflectionHelper()
    • Method Detail

      • newInstance

        public static <E> E newInstance​(Class<E> clazz,
                                        Collection<?> args,
                                        boolean nullIfMissing)
        Invoke constructor on clazz to create new instance. Try to find argument for constructor in args parameter.
        Type Parameters:
        E - FIXME
        Parameters:
        clazz - class of object to instantiate
        args - all possible parameter that constructor can used
        nullIfMissing - if no suitable class or object found in args, use null value (no exception)
        Returns:
        new instance
        Throws:
        IllegalArgumentException - if something is wrong during instantiation
      • choiceArgument

        public static Object choiceArgument​(Class<?> clazz,
                                            List args,
                                            boolean nullIfMissing)
        Permet de matcher un type d'argument attendu clazz parmi un ensemble possible de candidat. Les candidats peuvent etre des classes qu'il faudra instancier pour satisfaire le type demande.
        Parameters:
        clazz - le type recherché
        args - la liste des arguments ou des types
        nullIfMissing - pour retourner nulle si l'argument n'est pas trouvé
        Returns:
        le type d'argument trouvé
      • getMethod

        public static List<Method> getMethod​(Class<?> clazz,
                                             String methodName,
                                             boolean ignoreCase)
        Get all methods with name given in argument without check parameters.
        Parameters:
        clazz - where to search method
        methodName - method name to search
        ignoreCase - if true, ignore difference in method name case
        Returns:
        list of detected methods
      • getMethod

        public static List<Method> getMethod​(String name,
                                             boolean ignoreCase)
        List method that match name, name must be [package.][class][#][method] if package, class or method missing, exception throw
        Parameters:
        name - name of the method
        ignoreCase - check exact method name if false
        Returns:
        list of method that match name
        Since:
        2.6.9