com.bluemarsh.jswat.breakpoint
Class LineBreakpoint

java.lang.Object
  |
  +--com.bluemarsh.jswat.breakpoint.DefaultBreakpoint
        |
        +--com.bluemarsh.jswat.breakpoint.ResolvableBreakpoint
              |
              +--com.bluemarsh.jswat.breakpoint.LineBreakpoint
All Implemented Interfaces:
Breakpoint, java.util.EventListener, LocatableBreakpoint, java.io.Serializable, VMEventListener

public class LineBreakpoint
extends ResolvableBreakpoint
implements LocatableBreakpoint, VMEventListener

Class LineBreakpoint implements the Breakpoint interface. Its properties include a class and a line number in that class at which the breakpoint should stop.

Author:
Nathan Fiedler
See Also:
Serialized Form

Field Summary
protected  int lineNumber
          Line number of breakpoint.
protected static Category logCategory
          Reporting category.
 
Fields inherited from class com.bluemarsh.jswat.breakpoint.ResolvableBreakpoint
eventRequest, prepareRequest, referenceSpec
 
Fields inherited from class com.bluemarsh.jswat.breakpoint.DefaultBreakpoint
breakpointGroup, conditionList, deleteOnExpire, expireCount, isEnabled, monitorList, propertyList, skipCount, stoppedCount, suspendPolicy
 
Fields inherited from interface com.bluemarsh.jswat.event.VMEventListener
PRIORITY_BREAKPOINT, PRIORITY_DEFAULT, PRIORITY_HIGH, PRIORITY_HIGHEST, PRIORITY_LOW, PRIORITY_LOWEST, PRIORITY_SESSION
 
Fields inherited from interface com.bluemarsh.jswat.breakpoint.Breakpoint
serialVersionUID
 
Constructor Summary
LineBreakpoint(java.lang.String classPattern, int line)
          Constructs a LineBreakpoint for the given class at the specified line within that class.
 
Method Summary
 boolean eventOccurred(com.sun.jdi.event.Event e)
          Invoked when a VM event has occurred.
 java.lang.String getClassName()
          Return the name of the class that this breakpoint is located in.
 int getLineNumber()
          Return the line number at which this breakpoint is set.
 com.sun.jdi.Location getLocation()
          Retrieve the location associated with this breakpoint.
 BreakpointUI getUIAdapter()
          Returns the user interface widget for customizing this breakpoint.
 void init()
          Initialize the breakpoint so it may operate normally.
protected  com.sun.jdi.request.EventRequest resolveReference(com.sun.jdi.ReferenceType refType)
          Resolve against the given ReferenceType.
 void setLineNumber(int line)
          Set the line number at which this breakpoint is set.
 java.lang.String toString()
          Returns a String representation of this.
 java.lang.String toString(boolean terse)
          Returns a String representation of this.
 
Methods inherited from class com.bluemarsh.jswat.breakpoint.ResolvableBreakpoint
destroy, eventRequest, getReferenceTypeSpec, isResolved, reset, resolveAgainstEvent, resolveEagerly, setEnabled, setSuspendPolicy, unresolve
 
Methods inherited from class com.bluemarsh.jswat.breakpoint.DefaultBreakpoint
addCondition, addMonitor, conditions, deleteOnExpire, fireChange, getBreakpointGroup, getBreakpointManager, getExpireCount, getProperty, getSkipCount, getSuspendPolicy, hasExpired, incrementStoppedCount, isEnabled, isSkipping, monitors, performStop, removeCondition, removeMonitor, setBreakpointGroup, setExpireCount, setProperty, setSkipCount, shouldResume
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logCategory

protected static Category logCategory
Reporting category.

lineNumber

protected int lineNumber
Line number of breakpoint.
Constructor Detail

LineBreakpoint

public LineBreakpoint(java.lang.String classPattern,
                      int line)
               throws java.lang.ClassNotFoundException
Constructs a LineBreakpoint for the given class at the specified line within that class.
Parameters:
classPattern - name of class in which to set breakpoint, possibly using wildcards.
line - line at which to stop.
Throws:
java.lang.ClassNotFoundException - Thrown if classPattern is not a valid identifier.
Method Detail

eventOccurred

public boolean eventOccurred(com.sun.jdi.event.Event e)
Invoked when a VM event has occurred.
Specified by:
eventOccurred in interface VMEventListener
Parameters:
e - VM event.
Returns:
true if debuggee VM should be resumed, false otherwise.

getClassName

public java.lang.String getClassName()
Return the name of the class that this breakpoint is located in. This could be a fully-qualified class name or a wild-carded name pattern containing a single asterisk (e.g. "*.cname").
Specified by:
getClassName in interface LocatableBreakpoint
Returns:
Class name if known, null if not.

getLineNumber

public int getLineNumber()
Return the line number at which this breakpoint is set.
Specified by:
getLineNumber in interface LocatableBreakpoint
Returns:
line number at this this breakpoint is set.

getLocation

public com.sun.jdi.Location getLocation()
Retrieve the location associated with this breakpoint. The caller may want to call isResolved() before calling this method. An unresolved breakpoint will not have a location yet.
Specified by:
getLocation in interface LocatableBreakpoint
Returns:
location of breakpoint, or null if not resolved.

getUIAdapter

public BreakpointUI getUIAdapter()
Returns the user interface widget for customizing this breakpoint. This method returns a new ui adapter each time it is called.
Overrides:
getUIAdapter in class DefaultBreakpoint
Returns:
Breakpoint user interface adapter.

init

public void init()
Initialize the breakpoint so it may operate normally.
Overrides:
init in class DefaultBreakpoint

resolveReference

protected com.sun.jdi.request.EventRequest resolveReference(com.sun.jdi.ReferenceType refType)
                                                     throws ResolveException
Resolve against the given ReferenceType. If successful, return the new event request.
Overrides:
resolveReference in class ResolvableBreakpoint
Parameters:
refType - ReferenceType against which to resolve.
Returns:
event request, or null if not resolved.
Throws:
ResolveException - Thrown if breakpoint resolve fails.

setLineNumber

public void setLineNumber(int line)
Set the line number at which this breakpoint is set. This method will force the breakpoint to be unresolved. It must be resolved again before it will be effective.
Parameters:
line - line number at this this breakpoint is set.

toString

public java.lang.String toString(boolean terse)
Returns a String representation of this.
Parameters:
terse - true to keep the description terse.

toString

public java.lang.String toString()
Returns a String representation of this.
Overrides:
toString in class java.lang.Object