wyvern.lib
Interface MethodHookable

All Known Subinterfaces:
Armor, Attackable, Bag, Commandable, Damageable, GameMap, GameObject, HitNotify, Hookable, Inventory, Monster, Openable, Player, Weapon
All Known Implementing Classes:
AbstractAttack, AbstractCommandable, AbstractGameMap, ArmorImpl, AttackingBodyPart, BasicBag, Chest, DiggableWall, Door, DynamicObject, Generator, HookList, MapObject, MonsterImpl, MonsterInventory, PlayerImpl, Trenchcoat, WeaponImpl

public interface MethodHookable

Objects can use this interface to provide "method-hooks" for themselves. MethodHookCallbacks can register for these hooks.

Version:
1.0, Nov 20, 1999
Author:
Steve Yegge

Method Summary
 void addMethodHook(MethodHookCallback callback, java.lang.String methodName)
          Registers for the specified method-hook.
 void removeMethodHook(MethodHookCallback callback, java.lang.String methodName)
          Unregisters for the specified method-hook.
 void runMethodHook(java.lang.String hookName, java.lang.Object data)
          Runs the specific method hook.
 

Method Detail

addMethodHook

public void addMethodHook(MethodHookCallback callback,
                          java.lang.String methodName)
Registers for the specified method-hook. Only a select few methods actually have hooks, and there is no checking done to make sure the hook name matches a real method on the target. Be sure to check the documentation for a hookable method to see what the hook name for that method is defined to be.

Parameters:
methodName - the name of the method to hook into
callback - the MethodHookCallback object to notify on the hook

removeMethodHook

public void removeMethodHook(MethodHookCallback callback,
                             java.lang.String methodName)
Unregisters for the specified method-hook.

Parameters:
methodName - the name of the method
callback - the MethodHookCallback object to notify on the hook

runMethodHook

public void runMethodHook(java.lang.String hookName,
                          java.lang.Object data)
Runs the specific method hook.

Parameters:
hookName - the name of the method, e.g. "add"
data - any data to pass to the callbacks; can be null