01: // Copyright 2006 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14:
15: package org.apache.tapestry;
16:
17: import org.apache.tapestry.runtime.Component;
18: import org.apache.tapestry.runtime.ComponentEvent;
19:
20: /**
21: * Handler for a {@link ComponentEvent}, notified when a non-null value is returned from some event
22: * handler method.
23: * <p>
24: * TODO: Multiple handlers for different result types / strategy pattern?
25: */
26: public interface ComponentEventHandler<T> {
27: /**
28: * Invoked to handle a non-null event handler method result. The handler should determine
29: * whether the value is acceptible, and throw an exception if not.
30: *
31: * @param result
32: * the result value provided by a method
33: * @param component
34: * the component from which the result was obtained
35: * @param methodDescription
36: * a string description of the class and method name (used when errors occur).
37: * @return true if the event is aborted, false if the event may continue
38: */
39: boolean handleResult(T result, Component component,
40: String methodDescription);
41: }
|