com.bluemarsh.jswat.breakpoint
Class ResolvableBreakpoint

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

public abstract class ResolvableBreakpoint
extends DefaultBreakpoint

Class ResolvableBreakpoint represents a breakpoint that requires resolution against a class in the debuggee VM. Such breakpoints include the location breakpoint, exception breakpoint, and watchpoint breakpoint.

Author:
Nathan Fiedler
See Also:
Serialized Form

Field Summary
protected  com.sun.jdi.request.EventRequest eventRequest
          Resolved event request if any, or null if not yet resolved.
protected  com.sun.jdi.request.ClassPrepareRequest prepareRequest
          Class prepare request used to resolve the breakpoint.
protected  ReferenceTypeSpec referenceSpec
          Specification for the class this breakpoint is meant for.
 
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.breakpoint.Breakpoint
serialVersionUID
 
Method Summary
 void destroy()
          Tear down this breakpoint in preparation for deletion.
 com.sun.jdi.request.EventRequest eventRequest()
          Returns the event request for this breakpoint, if the breakpoint has been resolved.
 ReferenceTypeSpec getReferenceTypeSpec()
          Returns the reference type spec of this breakpoint.
 boolean isResolved()
          Returns true if the breakpoint has been resolved against the intended object in the debuggee VM.
 void reset()
          Reset the stopped count to zero and clear any other attributes such that this breakpoint can be used again.
 com.sun.jdi.request.EventRequest resolveAgainstEvent(com.sun.jdi.event.ClassPrepareEvent event)
          Try to resolve this breakpoint against the class prepare event.
 com.sun.jdi.request.EventRequest resolveEagerly(com.sun.jdi.VirtualMachine vm)
          Try to resolve this event request eagerly.
protected abstract  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.
 void setSuspendPolicy(int policy)
          Set the suspend policy for the request.
protected  void unresolve()
          Make this breakpoint unresolved.
 
Methods inherited from class com.bluemarsh.jswat.breakpoint.DefaultBreakpoint
addCondition, addMonitor, conditions, deleteOnExpire, fireChange, getBreakpointGroup, getBreakpointManager, getExpireCount, getProperty, getSkipCount, getSuspendPolicy, getUIAdapter, hasExpired, incrementStoppedCount, init, 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, toString, wait, wait, wait
 
Methods inherited from interface com.bluemarsh.jswat.breakpoint.Breakpoint
toString
 

Field Detail

referenceSpec

protected ReferenceTypeSpec referenceSpec
Specification for the class this breakpoint is meant for.

prepareRequest

protected transient com.sun.jdi.request.ClassPrepareRequest prepareRequest
Class prepare request used to resolve the breakpoint.

eventRequest

protected transient com.sun.jdi.request.EventRequest eventRequest
Resolved event request if any, or null if not yet resolved.
Method Detail

destroy

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

eventRequest

public com.sun.jdi.request.EventRequest eventRequest()
Returns the event request for this breakpoint, if the breakpoint has been resolved. If this value is non-null, the caller can be certain the breakpoint is resolved.
Overrides:
eventRequest in class DefaultBreakpoint
Returns:
breakpoint's event request.
See Also:
isResolved()

getReferenceTypeSpec

public ReferenceTypeSpec getReferenceTypeSpec()
Returns the reference type spec of this breakpoint.
Returns:
the reference type spec.

isResolved

public boolean isResolved()
Returns true if the breakpoint has been resolved against the intended object in the debuggee VM. How a breakpoint resolves itself depends on the type of the breakpoint.
Overrides:
isResolved in class DefaultBreakpoint
Returns:
true if this breakpoint has resolved, false otherwise.

reset

public void reset()
Reset the stopped count to zero and clear any other attributes such that this breakpoint can be used again. This does not change the enabled-ness of the breakpoint.
Overrides:
reset in class DefaultBreakpoint

resolveAgainstEvent

public com.sun.jdi.request.EventRequest resolveAgainstEvent(com.sun.jdi.event.ClassPrepareEvent event)
                                                     throws ResolveException
Try to resolve this breakpoint against the class prepare event.
Parameters:
event - class prepare event
Returns:
event request, or null if it could not be resolved.

resolveEagerly

public com.sun.jdi.request.EventRequest resolveEagerly(com.sun.jdi.VirtualMachine vm)
                                                throws ResolveException
Try to resolve this event request eagerly. That is, try to find a matching prepared class now. If one is not found, create a class prepare request so we can resolve when the class is loaded.
Parameters:
vm - VirtualMachine
Returns:
event request, or null if it could not be resolved.

resolveReference

protected abstract 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.
Parameters:
refType - ReferenceType against which to resolve.
Returns:
event request, or null if not resolved.

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 DefaultBreakpoint
Parameters:
enabled - true if breakpoint should be enabled, false if breakpoint should be disabled.
See Also:
DefaultBreakpoint.isEnabled

setSuspendPolicy

public void setSuspendPolicy(int policy)
Set the suspend policy for the request. Use one of the com.sun.jdi.request.EventRequest constants for suspending threads.
Overrides:
setSuspendPolicy in class DefaultBreakpoint
Parameters:
policy - one of the EventRequest suspend constants.

unresolve

protected void unresolve()
Make this breakpoint unresolved.