Class ClassUtils

    • Method Detail

      • getConstructor

        public static Constructor<?> getConstructor​(Class<?> type,
                                                    Class<?>[] parameterTypes)
                                             throws NoSuchMethodException
        Attempts to find a constructor for the provided class matching with the provided parameter types.
        Parameters:
        type - the type of the class on which to perform the lookup
        parameterTypes - the types of arguments expected for the constructor signature
        Returns:
        a matching Constructor instance
        Throws:
        NoSuchMethodException - thrown if no matching constructor could be found
      • getMethod

        public static Method getMethod​(Class<?> type,
                                       String methodName,
                                       Class<?>[] parameterTypes)
                                throws NoSuchMethodException
        Attempts to find a method for the provided class matching with the provided parameter types.
        Parameters:
        type - the type of the class on which to perform the lookup
        methodName - the name of the method
        parameterTypes - the types of the arguments expected for the method signature
        Returns:
        a matching Method instance
        Throws:
        NoSuchMethodException - thrown if no matching method could be found
      • matchesArgumentType

        public static boolean matchesArgumentType​(Class<?> providedType,
                                                  Class<?> argumentType)
        Checks whether a given type "matches" with another type found in a method/ctor signature.
        Parameters:
        providedType - the type of an input
        argumentType - the type found in a method/ctor signature
        Returns:
        true if the types are compatible, false otherwise
      • isBoxedTypeFor

        public static boolean isBoxedTypeFor​(Class<?> c1,
                                             Class<?> c2)
        Parameters:
        c1 -
        c2 -
        Returns:
      • isParseableAsBoolean

        public static boolean isParseableAsBoolean​(String value)
        Parameters:
        value -
        Returns: