|
Griffon 1.2.0 | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectGriffonNameUtils
griffon.util.GriffonUtil
public class GriffonUtil extends GriffonNameUtils
Griffon utility methods for command line and GUI applications
Field Summary | |
---|---|
private static String |
GRIFFON_IMPLEMENTATION_TITLE
|
private static String[] |
GRIFFON_PACKAGES
|
private static String |
GRIFFON_VERSION
|
private static Log |
LOG
|
private static Log |
STACK_LOG
|
Constructor Summary | |
private GriffonUtil()
|
Method Summary | |
---|---|
static Throwable
|
deepSanitize(Throwable t)
|
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)
|
static String
|
getEnvironment()
Retrieves the current execution environment |
static String
|
getGriffonVersion()
|
static String
|
getNameFromScript(String scriptName)
Calculates the class name from a script name in the form my-funk-griffon-script |
static String
|
getPluginName(String descriptorName)
Returns the name of a plugin given the name of the *GriffonPlugin.groovy descriptor file. |
static String
|
getScriptName(Class clazz)
Retrieves the script name representation of the supplied class. |
static String
|
getScriptName(String name)
Retrieves the script name representation of the given class name. |
static boolean
|
isApplicationClass(String className)
|
static boolean
|
isDevelopmentEnv()
Retrieves whether the current execution environment is the development one |
static void
|
printSanitizedStackTrace(Throwable t, PrintWriter p)
|
static void
|
printSanitizedStackTrace(Throwable t)
|
static Throwable
|
sanitize(Throwable t)
|
static Throwable
|
sanitizeRootCause(Throwable t)
|
static void
|
warn(String message)
Logs warning message to griffon.util.GriffonUtil logger which is turned on in development mode. |
static void
|
writeSlurperResult(GPathResult result, Writer output)
Writes out a GPathResult (i.e. the result of parsing XML using XmlSlurper) to the given writer. |
Field Detail |
---|
private static final String GRIFFON_IMPLEMENTATION_TITLE
private static final String[] GRIFFON_PACKAGES
private static final String GRIFFON_VERSION
private static final Log LOG
private static final Log STACK_LOG
Constructor Detail |
---|
private GriffonUtil()
Method Detail |
---|
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
public static void deprecated(Class clazz, String methodOrPropName)
clazz
- A classmethodOrPropName
- Name of deprecated property or method
public static void deprecated(Class clazz, String methodOrPropName, String version)
clazz
- A classmethodOrPropName
- Name of deprecated property or methodversion
- Version of Griffon release in which property or method were deprecated
public static void deprecated(String message)
message
- Message to display
public static Throwable extractRootCause(Throwable t)
Extracts the root cause of the exception, no matter how nested it is
t
- the throwable to sanitize
public static String getEnvironment()
public static String getGriffonVersion()
public static String getNameFromScript(String scriptName)
scriptName
- The script name
public static String getPluginName(String descriptorName)
descriptorName
- The simple name of the plugin descriptor.null
if descriptorName is null
, or an empty string
if descriptorName is an empty string.
public static String getScriptName(Class clazz)
clazz
- The class to convert
public static String getScriptName(String name)
name
- The class name to convert.
public static boolean isApplicationClass(String className)
public static boolean isDevelopmentEnv()
public static void printSanitizedStackTrace(Throwable t, PrintWriter p)
public static void printSanitizedStackTrace(Throwable t)
public static Throwable sanitize(Throwable t)
Remove all apparently Griffon-internal trace entries from the exception instance
This modifies the original instance and returns it, it does not clone
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
- the throwable to sanitize
public static void warn(String message)
message
- Message to display
public static void writeSlurperResult(GPathResult result, Writer output)
result
- The root node of the XML to write out.output
- Where to write the XML to.
Groovy Documentation