GrailsUtil (Grails 6.0.0)

Package: grails.util

## [Java] Class GrailsUtil

- grails.util.GrailsUtil

-     public class GrailsUtil
      extends java.lang.Object

  Grails utility methods for command line and GUI applications.

  Authors:
    Graeme Rocher
  Since:
    0.2

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `private static org.apache.commons.logging.Log` | `LOG` |
    `private static boolean` | `LOG_DEPRECATED` |
    `private static StackTraceFilterer` | `stackFilterer` |

  - ### Constructor Summary

    Constructors
    Constructor and description
    `private GrailsUtil ()`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public static java.lang.Throwable` | `deepSanitize(java.lang.Throwable t)`
    `` | `public static void` | `deprecated(java.lang.Class<?> clazz, java.lang.String methodOrPropName)` Logs warning message about deprecation of specified property or method of some class.
    `` | `public static void` | `deprecated(java.lang.Class<?> clazz, java.lang.String methodOrPropName, java.lang.String version)` Logs warning message about deprecation of specified property or method of some class.
    `` | `public static void` | `deprecated(java.lang.String message)` Logs warning message about some deprecation and code style related hints.
    `` | `public static java.lang.Throwable` | `extractRootCause(java.lang.Throwable t)`
    `` | `public static java.lang.String` | `getGrailsVersion()`
    `` | `private static boolean` | `isBlank(java.lang.String value)`
    `` | `public static boolean` | `isDevelopmentEnv()` Retrieves whether the current execution environment is the development one.
    `` | `public static void` | `printSanitizedStackTrace(java.lang.Throwable t, java.io.PrintWriter p)`
    `` | `public static void` | `printSanitizedStackTrace(java.lang.Throwable t, java.io.PrintWriter p, StackTraceFilterer stackTraceFilterer)`
    `` | `public static void` | `printSanitizedStackTrace(java.lang.Throwable t)`
    `` | `public static java.lang.Throwable` | `sanitizeRootCause(java.lang.Throwable t)`
    `` | `public static void` | `warn(java.lang.String message)` Logs warning message to grails.util.GrailsUtil logger which is turned on in development mode.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Field Detail

    - #### private static final org.apache.commons.logging.Log LOG

    - #### private static final boolean LOG_DEPRECATED

    - #### private static final StackTraceFilterer stackFilterer

  - ### Constructor Detail

    - #### private GrailsUtil()

  - ### Method Detail

    - #### public static java.lang.Throwable deepSanitize(java.lang.Throwable t)

      Sanitize the exception and ALL nested causes

      This will MODIFY the stacktrace of the exception instance and all its causes irreversibly

      Parameters:
        t
      Returns:
        The root cause exception instances, with stack trace modified to filter out grails runtime classes

    - #### public static void deprecated(java.lang.Class<?> clazz, java.lang.String methodOrPropName)

      Logs warning message about deprecation of specified property or method of some class.

      Parameters:
        `clazz` - A class
        `methodOrPropName` - Name of deprecated property or method

    - #### public static void deprecated(java.lang.Class<?> clazz, java.lang.String methodOrPropName, java.lang.String version)

      Logs warning message about deprecation of specified property or method of some class.

      Parameters:
        `clazz` - A class
        `methodOrPropName` - Name of deprecated property or method
        `version` - Version of Grails release in which property or method were deprecated

    - #### public static void deprecated(java.lang.String message)

      Logs warning message about some deprecation and code style related hints.

      Parameters:
        `message` - Message to display

    - #### public static java.lang.Throwable extractRootCause(java.lang.Throwable t)

      Extracts the root cause of the exception, no matter how nested it is

      Parameters:
        t
      Returns:
        The deepest cause of the exception that can be found

    - #### public static java.lang.String getGrailsVersion()

    - #### private static boolean isBlank(java.lang.String value)

    - #### public static boolean isDevelopmentEnv()

      Retrieves whether the current execution environment is the development one.

      Returns:
        true if it is the development environment

    - #### public static void printSanitizedStackTrace(java.lang.Throwable t, java.io.PrintWriter p)

    - #### public static void printSanitizedStackTrace(java.lang.Throwable t, java.io.PrintWriter p, StackTraceFilterer stackTraceFilterer)

    - #### public static void printSanitizedStackTrace(java.lang.Throwable t)

    - #### public static java.lang.Throwable sanitizeRootCause(java.lang.Throwable t)

      Get the root cause of an exception and sanitize it for display to the user

      This will MODIFY the stacktrace of the root cause exception object and return it

      Parameters:
        t
      Returns:
        The root cause exception instance, with its stace trace modified to filter out grails runtime classes

    - #### public static void warn(java.lang.String message)

      Logs warning message to grails.util.GrailsUtil logger which is turned on in development mode.

      Parameters:
        `message` - Message to display