- public function add(handlerType:Class):InstanceHandlerCollection {
- var handler:* = instanceClass(handlerType);
- var foundType:Boolean = false;
- if (handler is BeforeInstanceHandler) {
- beforeHandlers.push(handler);
- foundType = true;
- }
- if (handler is AfterInstanceHandler) {
- afterHandlers.push(handler);
- foundType = true;
- }
- if (!foundType)
- throw new NotAnInstanceHandlerError(handlerType);
- return this;
- }