consciouscode.util
Class Thunk

java.lang.Object
  extended by consciouscode.util.Thunk
All Implemented Interfaces:
Runnable

public class Thunk
extends Object
implements Runnable

A Runnable object that uses reflection to invoke a no-argument method on a particular object.


Constructor Summary
Thunk(Object target, String callbackMethodName)
          Create a new Runnable whose run() method will invoke the named method on the target.
 
Method Summary
 void run()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Thunk

public Thunk(Object target,
             String callbackMethodName)
      throws IllegalArgumentException,
             SecurityException
Create a new Runnable whose run() method will invoke the named method on the target.

Throws:
IllegalArgumentException - if callbackMethodName does not identify a public no-parameter method on the target object, or if the callback throws any checked exception.
SecurityException
Method Detail

run

public void run()
Specified by:
run in interface Runnable


Copyright © 2001–2012 Todd V. Jonker. All Rights Reserved.