Package com.sun.javatest.util
Class Debug
java.lang.Object
com.sun.javatest.util.Debug
Access to debugging settings which have been activated.
Indexing is by string matching; the key is usually but not always a fully qualified
classname.
The system properties have three classes of "value" data. The string may be equal to the string "true" (case insensitive), it may be parsable into an integer (by Integer.parseInt()), or it may be any other string. In the latter case where it is not TRUE and is not an int, it will be interpreted as a zero if a integer is requested, and FALSE if a boolean is requested.
The following definitions define how integer and boolean settings are interpreted:
- A lookup that results in a valid integer:
- Will return that integer for any of the getInt() methods
- Will return false for any getBoolean() method if the integer is less than or equal to zero
- Will return true for and getBoolean() method if the integer is greater than zero
- Will return false for any getBoolean() method if the integer is less than or equal to zero
- A lookup that results in "true" (any case combination):
- Will return one for any of the getInt() methods
- Will return true for any of the getBoolean() methods
- A lookup that results in neither of the above cases (not "true", nor an integer):
- Will return zero for any of the getInt() methods
- Will return false for any of the getBoolean() methods
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
getBoolean
(Class<?> c) Find out the debugging setting for class c.static boolean
getBoolean
(Class<?> c, String suffix) Find out the debugging setting for class c.static boolean
getBoolean
(String s) Get a named debugging setting.static int
Find out the debugging setting for class c.static int
Find out the debugging setting for class c.static int
Get a named debugging setting.static String
getSetting
(String key) Do a raw lookup of a key, including matching of wildcard settings.static PrintWriter
Get the debugging stream, used for writing debug messages.static void
init
(boolean force) Initialize (or re-initialize) debugging support.static boolean
Check if overall debugging is enabled.static void
Print a debugging message.static void
Print a debugging message and end the line.static void
setProperties
(Properties props) Set properties containing debugging settings.
-
Method Details
-
print
Print a debugging message.- Parameters:
s
- the message to be printed.
-
println
Print a debugging message and end the line.- Parameters:
s
- the message to be printed.
-
isEnabled
public static boolean isEnabled()Check if overall debugging is enabled. If it is not enabled, methods will return null, false, and zero, as appropriate for the type.- Returns:
- true if debugging is enabled, and false otherwise
-
getSetting
Do a raw lookup of a key, including matching of wildcard settings. Is the given string matched by any of the debug system properties. The matching is done according to import-style semantics, using the dot separator. In addition wildcards from the system properties are allowed at the end of the key specification. Unlike imports, the wildcard can match inner class names.- Parameters:
key
- The name of the setting to be returned- Returns:
- The setting, or null if not found. Null is returned if debugging is disabled entirely.
-
getBoolean
Find out the debugging setting for class c. Lookup is done by looking for fully qualified class name.- Parameters:
c
- Class whose name should be used to lookup the setting, null results in a return value of zero.- Returns:
- the debugging setting for the specified class
-
getBoolean
Find out the debugging setting for class c. Lookup is done by looking for fully qualified class name with a dot and the given suffix appended.- Parameters:
c
- Class whose name should be used to lookup the setting, null results in a return value of zero.suffix
- String to append to the classname, null will result in a lookup of just the classname.- Returns:
- the debugging setting for the specified class
-
getBoolean
Get a named debugging setting.- Parameters:
s
- the name of the desired debugging setting- Returns:
- the value of the debugging setting
-
getInt
Find out the debugging setting for class c. Lookup is done by looking for fully qualified class name.- Parameters:
c
- the class whose name should be used to lookup the setting- Returns:
- the debugging setting for the given class, or 0 if no class was specified
-
getInt
Find out the debugging setting for class c. Lookup is done by looking for fully qualified class name with a dot and the given suffix appended.- Parameters:
c
- a class whose name should be used to lookup the setting; null results in a return value of zero.suffix
- a string to append to the classname; null will result in a lookup of just the classname.- Returns:
- the debugging setting for the class
-
getInt
Get a named debugging setting.- Parameters:
s
- the name of the desired debugging setting- Returns:
- the value of the debugging setting
-
getWriter
Get the debugging stream, used for writing debug messages.- Returns:
- the debugging stream, used to write debug messages
-
setProperties
Set properties containing debugging settings. This is required if the security manager does not allow access to the system properties.- Parameters:
props
- A table of properties containing debugging settings
-
init
public static void init(boolean force) Initialize (or re-initialize) debugging support.- Parameters:
force
- Force reprocessing of System properties.
-