jde.debugger
Class Etc

java.lang.Object
  |
  +--jde.debugger.Etc

public class Etc
extends java.lang.Object

Etc.java

random useful utilities

Created: Thu Jul 8 13:01:24 1999

Since:
0.1

Constructor Summary
Etc()
           
 
Method Summary
static void dump(java.lang.Object obj)
          dump a particular object, in whatever way seems appropriate
static com.sun.jdi.Value evaluate(java.lang.String expr, com.sun.jdi.StackFrame frame)
          Evaluate an expression, given a context
static java.util.List getClassExFiltersFromArgs(java.util.List args)
          Parses the list of arguments for class exclusion filter information.
static java.util.List getClassFiltersFromArgs(java.util.List args)
          Parses the list of arguments for class filter information.
static java.lang.String getExprFromArgs(java.util.List args)
          Parses the list of arguments for expression information.
static java.lang.Long getObjectIDFromArgs(java.util.List args)
          Parses the list of arguments for object ID information.
static int getSuspendPolicyFromArgs(java.util.List args)
          Parses the list of arguments for suspend policy information.
static java.lang.Object getThreadFromArgs(java.util.List args)
          Parses the list of arguments for thread information.
static int safeGetint(java.lang.Object obj, java.lang.String type)
          Safely convert to an int, raising an appropriate JDENumberFormatException if required
static java.lang.Long safeGetLong(java.lang.Object obj, java.lang.String type)
          Safely convert to a Long, raising an appropriate JDENumberFormatException if required
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

Etc

public Etc()
Method Detail

dump

public static void dump(java.lang.Object obj)
dump a particular object, in whatever way seems appropriate
Parameters:
obj - The object to dump

safeGetLong

public static java.lang.Long safeGetLong(java.lang.Object obj,
                                         java.lang.String type)
                                  throws JDEException
Safely convert to a Long, raising an appropriate JDENumberFormatException if required
Parameters:
obj - The object to convert. The .toString() is used.
type - The type of long: used in the exception string if required
Returns:
the Long, or raises exception.

safeGetint

public static int safeGetint(java.lang.Object obj,
                             java.lang.String type)
                      throws JDEException
Safely convert to an int, raising an appropriate JDENumberFormatException if required
Parameters:
obj - The object to convert. The .toString() is used.
type - The type of int: used in the exception string if required
Returns:
the Integer, or raises exception.

evaluate

public static com.sun.jdi.Value evaluate(java.lang.String expr,
                                         com.sun.jdi.StackFrame frame)
                                  throws JDEException
Evaluate an expression, given a context

Parameters:
expr - The expression to evaluate
frame - The stackframe that defines the context
Returns:
a value

getThreadFromArgs

public static java.lang.Object getThreadFromArgs(java.util.List args)
                                          throws JDEException
Parses the list of arguments for thread information.
 on_thread_id   threadID
 on_thread_name "threadName"
 
Note that the exception is not raised if the tags are not present: only if what follows the tag is incorrect.

Commands having this argument will raise events only if the event thread matches the specification. More details in EventHandler.

Shortcuts: -tid and -tname

Returns:
a Long corresponding to the threadID, or the string "threadName"
Throws:
JDEException - If the information cannot be resolved

getExprFromArgs

public static java.lang.String getExprFromArgs(java.util.List args)
                                        throws JDEException
Parses the list of arguments for expression information.
 if "expression"
 
Note that the exception is not raised if the tag isn't present: only if what follows the tag is incorrect.

When used, the expression is evaluated at the time of the event, and the event passed to jde if the expression evaluates to "true".

Shortcut: -e

Returns:
string corresponding to the expression
Throws:
JDEException - If the information cannot be resolved

getClassFiltersFromArgs

public static java.util.List getClassFiltersFromArgs(java.util.List args)
                                              throws JDEException
Parses the list of arguments for class filter information.
 class_filters "classPatternList"
 
Note that the exception is not raised if the tag isn't present: only if what follows the tag is incorrect.

the classPatternList should be a list of class patterns, using space or comma as delimiter.

Shortcut: -cf

This constraint is used to add class filters to events. To quote JDI documentation:

Restricts the events generated by this request to those whose location is in a class whose name matches a restricted regular expression. Regular expressions are limited to exact matches and patterns that begin with '*' or end with '*'; for example, "*.Foo" or "java.*".

Returns:
a List of all the class filters.
Throws:
JDEException - If the information cannot be resolved

getClassExFiltersFromArgs

public static java.util.List getClassExFiltersFromArgs(java.util.List args)
                                                throws JDEException
Parses the list of arguments for class exclusion filter information.
 class_exclusion_filters "classPatternList"
 
Note that the exception is not raised if the tag isn't present: only if what follows the tag is incorrect.

the classPatternList should be a list of class patterns, using space or comma as delimiter.

Shortcut: -cef

This is used to add class exclusion filters to events. To quote JDI documentation:

Restricts the events generated by this request to those whose location is in a class whose name does not match this restricted regular expression. Regular expressions are limited to exact matches and patterns that begin with '*' or end with '*'; for example, "*.Foo" or "java.*".

Returns:
a List of all the class exclusion filters.
Throws:
JDEException - If the information cannot be resolved

getSuspendPolicyFromArgs

public static int getSuspendPolicyFromArgs(java.util.List args)
                                    throws JDEException
Parses the list of arguments for suspend policy information.
 using_suspend_policy policy
 
Note that the exception is not raised if the tags are not present: only if what follows the tag is incorrect.

policy is one of "all", "thread", or "none". "all" means the entire VM is suspended when the event occurs, "thread" indicates only the thread on which the event occurs is suspended (only for events associated with threads), while "none" means nothing is suspended when the event occurs.

Shortcut: -sp

Returns:
a valid int indicating the suspend policy
Throws:
JDEException - If the information cannot be resolved

getObjectIDFromArgs

public static java.lang.Long getObjectIDFromArgs(java.util.List args)
                                          throws JDEException
Parses the list of arguments for object ID information.
 if_object_id objectID
 
Note that the exception is not raised if the tag isn't present: only if what follows the tag is incorrect.

Shortcut: -oid

Returns:
a Long corresponding to the object ID.
Throws:
JDEException - If the information cannot be resolved