com.bluemarsh.jswat.breakpoint
Class LocationBreakpoint

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

public abstract class LocationBreakpoint
extends ResolvableBreakpoint
implements LocatableBreakpoint

Class LocationBreakpoint is the base class for all breakpoints that are based on a particular location in code. This includes line breakpoints and method breakpoints.

Author:
Nathan Fiedler
See Also:
Serialized Form

Field Summary
protected  int lineNumber
          Line number of breakpoint.
 
Fields inherited from class com.bluemarsh.jswat.breakpoint.ResolvableBreakpoint
eventRequest, prepareRequest, referenceSpec
 
Fields inherited from class com.bluemarsh.jswat.breakpoint.DefaultBreakpoint
breakpointGroup, classFilters, conditionList, deleteOnExpire, expireCount, isEnabled, logCategory, monitorList, propertyList, skipCount, stoppedCount, suspendPolicy, threadFilters
 
Fields inherited from interface com.bluemarsh.jswat.breakpoint.Breakpoint
serialVersionUID
 
Fields inherited from interface com.bluemarsh.jswat.event.VMEventListener
PRIORITY_BREAKPOINT, PRIORITY_DEFAULT, PRIORITY_HIGH, PRIORITY_HIGHEST, PRIORITY_LOW, PRIORITY_LOWEST, PRIORITY_SESSION
 
Method Summary
protected  com.sun.jdi.request.EventRequest createEventRequest(com.sun.jdi.Location location)
          Create the breakpoint event request against the given location.
 void destroy()
          Tear down this breakpoint in preparation for deletion.
 java.lang.String getClassName()
          Return the name of the class that this breakpoint is located in.
 int getLineNumber()
          Retrieve the line number associated with this breakpoint.
 com.sun.jdi.Location getLocation()
          Retrieve the location associated with this breakpoint.
 void init()
          Initialize the breakpoint so it may operate normally.
protected abstract  com.sun.jdi.Location resolveLocation(com.sun.jdi.ClassType clazz)
          Determine the location at which to set the breakpoint using the given class type.
protected  com.sun.jdi.request.EventRequest resolveReference(com.sun.jdi.ReferenceType refType)
          Resolve against the given ReferenceType.
 void setEnabled(boolean enabled)
          Enables or disables this breakpoint, according to the parameter.
 java.lang.String toString()
          Returns a String representation of this.
 
Methods inherited from class com.bluemarsh.jswat.breakpoint.ResolvableBreakpoint
deleteEventRequest, eventRequest, getReferenceTypeSpec, isResolved, reset, resolveAgainstEvent, resolveEagerly, setSuspendPolicy
 
Methods inherited from class com.bluemarsh.jswat.breakpoint.DefaultBreakpoint
addCondition, addMonitor, conditions, deleteOnExpire, eventOccurred, fireChange, getBreakpointGroup, getBreakpointManager, getClassFilters, getExpireCount, getProperty, getSkipCount, getSuspendPolicy, getThreadFilters, getUIAdapter, hasExpired, incrementStoppedCount, isEnabled, isSkipping, monitors, performStop, removeCondition, removeMonitor, setBreakpointGroup, setClassFilters, setExpireCount, setProperty, setSkipCount, setThreadFilters, shouldResume
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.bluemarsh.jswat.breakpoint.Breakpoint
toString
 

Field Detail

lineNumber

protected int lineNumber
Line number of breakpoint.
Method Detail

createEventRequest

protected com.sun.jdi.request.EventRequest createEventRequest(com.sun.jdi.Location location)
Create the breakpoint event request against the given location.
Parameters:
location - location at which to stop.
Returns:
event request.

destroy

public void destroy()
Tear down this breakpoint in preparation for deletion.
Overrides:
destroy in class ResolvableBreakpoint

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()
Retrieve the line number associated with this breakpoint. Not all location breakpoints will have a particular line associated with them (such as method breakpoints). In such cases, this method may return -1.
Specified by:
getLineNumber in interface LocatableBreakpoint
Returns:
line number of breakpoint, or -1 if unknown.

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.

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.

resolveLocation

protected abstract com.sun.jdi.Location resolveLocation(com.sun.jdi.ClassType clazz)
                                                 throws ResolveException
Determine the location at which to set the breakpoint using the given class type.
Parameters:
clazz - ClassType against which to resolve.
Returns:
Location at which to create breakpoint.

setEnabled

public void setEnabled(boolean enabled)
Enables or disables this breakpoint, according to the parameter. This only affects the breakpint itself. If the breakpoint group containing this breakpoint is disabled, this breakpoint will remain effectively disabled.
Overrides:
setEnabled in class ResolvableBreakpoint
Parameters:
enabled - true if breakpoint should be enabled, false if breakpoint should be disabled.
See Also:
DefaultBreakpoint.isEnabled

toString

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