|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object grails.util.GrailsUtil
public class GrailsUtil
Grails utility methods for command line and GUI applications
Constructor Summary | |
---|---|
GrailsUtil()
|
Method Summary | |
---|---|
static ApplicationContext |
bootstrapGrailsFromApplication(GrailsApplication application)
Bootstraps Grails with the given GrailsApplication instance |
static ApplicationContext |
bootstrapGrailsFromClassPath()
Bootstraps a Grails application from the current classpath. |
static ApplicationContext |
bootstrapGrailsFromParentContext(ApplicationContext parent)
Bootstraps Grails from the given parent ApplicationContext which should contain a bean definition called "grailsApplication" of type GrailsApplication |
static Throwable |
deepSanitize(Throwable t)
Sanitize the exception and ALL nested causes This will MODIFY the stacktrace of the exception instance and all its causes irreversibly |
static void |
deprecated(Class clazz,
String methodOrPropName)
Logs warning message about deprecation of specified property or method of some class. |
static void |
deprecated(Class clazz,
String methodOrPropName,
String version)
Logs warning message about deprecation of specified property or method of some class. |
static void |
deprecated(String message)
Logs warning message about some deprecation and code style related hints. |
static Throwable |
extractRootCause(Throwable t)
Extracts the root cause of the exception, no matter how nested it is |
static String |
getEnvironment()
Retrieves the current execution environment |
static String |
getGrailsVersion()
|
static boolean |
isApplicationClass(String className)
|
static boolean |
isDevelopmentEnv()
Retrieves whether the current execution environment is the development one |
static void |
printSanitizedStackTrace(Throwable t)
|
static void |
printSanitizedStackTrace(Throwable t,
PrintWriter p)
|
static Throwable |
sanitize(Throwable t)
Remove all apparently Grails-internal trace entries from the exception instance This modifies the original instance and returns it, it does not clone |
static Throwable |
sanitizeRootCause(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 |
static void |
warn(String message)
Logs warning message to grails.util.GrailsUtil logger which is turned on in development mode. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GrailsUtil()
Method Detail |
---|
public static ApplicationContext bootstrapGrailsFromClassPath()
Bootstraps a Grails application from the current classpath. The method will look for an applicationContext.xml file in the classpath that must contain a bean of type GrailsApplication and id grailsApplication
The method will then bootstrap Grails with the GrailsApplication and load all Grails plug-ins found in the path
public static ApplicationContext bootstrapGrailsFromApplication(GrailsApplication application)
application
- The GrailsApplication instance
public static ApplicationContext bootstrapGrailsFromParentContext(ApplicationContext parent)
public static String getEnvironment()
public static boolean isDevelopmentEnv()
public static String getGrailsVersion()
public static void deprecated(Class clazz, String methodOrPropName)
clazz
- A classmethodOrPropName
- Name of deprecated property or methodpublic static void deprecated(Class clazz, String methodOrPropName, String version)
clazz
- A classmethodOrPropName
- Name of deprecated property or methodversion
- Version of Grails release in which property or method were deprecatedpublic static void deprecated(String message)
message
- Message to displaypublic static void warn(String message)
message
- Message to displaypublic static Throwable sanitize(Throwable t)
Remove all apparently Grails-internal trace entries from the exception instance
This modifies the original instance and returns it, it does not clone
t
-
public static void printSanitizedStackTrace(Throwable t, PrintWriter p)
public static void printSanitizedStackTrace(Throwable t)
public static boolean isApplicationClass(String className)
public static Throwable extractRootCause(Throwable t)
Extracts the root cause of the exception, no matter how nested it is
t
-
public static Throwable sanitizeRootCause(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
t
-
public static Throwable deepSanitize(Throwable t)
Sanitize the exception and ALL nested causes
This will MODIFY the stacktrace of the exception instance and all its causes irreversibly
t
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |