Class ReflectionUtils


  • public final class ReflectionUtils
    extends Object
    Class to implement ReflectionUtils
    • Field Detail

      • NO_CLASS_ARGS

        public static final Class<?>[] NO_CLASS_ARGS
      • NO_OBJECT_ARGS

        public static final Object[] NO_OBJECT_ARGS
    • Method Detail

      • newInstance

        public static Object newInstance​(Class<?> clazz)
                                  throws Throwable
        Method to create a new instance of a Class
        Parameters:
        clazz - clazz
        Returns:
        object object
        Throws:
        Throwable - Throwable
      • isAbstract

        public static boolean isAbstract​(Class<?> clazz)
        Method to determine if a Class is abstract
        Parameters:
        clazz - clazz
        Returns:
        true if the Class is abstract, otherwise false
      • isAbstract

        public static boolean isAbstract​(Method method)
        Method to determine if a Method is abstract
        Parameters:
        method - method
        Returns:
        true if the Method is abstract, otherwise false
      • isStatic

        public static boolean isStatic​(Method method)
        Method to determine if a Method is static
        Parameters:
        method - method
        Returns:
        true if the Method is static, otherwise false
      • isPublic

        public static boolean isPublic​(Method method)
        Method to determine if a Method is public
        Parameters:
        method - method
        Returns:
        true if the Method is public, otherwise false
      • isProtected

        public static boolean isProtected​(Method method)
        Method to determine if a Method is protected
        Parameters:
        method - method
        Returns:
        true if the Method is protected, otherwise false
      • hasParameterCount

        public static boolean hasParameterCount​(Method method,
                                                int parameterCount)
        Method to determine if a Method has a specified parameter count
        Parameters:
        method - method
        parameterCount - parameterCount
        Returns:
        true if the Method has the specified parameter count, otherwise false
      • acceptsArguments

        public static boolean acceptsArguments​(Method method,
                                               Class<?>... parameterTypes)
        Method to determine if a Method accepts a specified set of parameters
        Parameters:
        method - method
        parameterTypes - parameterTypes
        Returns:
        true if the Method accepts the specified parameters, otherwise false
      • hasReturnType

        public static boolean hasReturnType​(Method method,
                                            Class<?> clazz)
        Method to determine if a Method returns a specific type
        Parameters:
        method - method
        clazz - clazz
        Returns:
        true if the Method returns a specific type, otherwise false