01: package org.vraptor.component;
02:
03: import java.lang.reflect.Method;
04: import java.util.List;
05: import java.util.ResourceBundle;
06:
07: import org.vraptor.LogicException;
08: import org.vraptor.LogicRequest;
09: import org.vraptor.validator.UnstableValidationException;
10: import org.vraptor.validator.ValidationErrors;
11:
12: /**
13: * A business logic method.
14: *
15: * @author Guilherme Silveira
16: */
17: public interface LogicMethod {
18:
19: /**
20: * Returns the logic's name
21: *
22: * @return its name
23: */
24: String getName();
25:
26: /**
27: * Executes the logic by invoking the method
28: *
29: * @param component
30: * the component to invoke the method on
31: * @param context
32: * @return the method's result
33: * @throws LogicException
34: * something wrong happenned
35: */
36: String execute(Object component, LogicRequest context,
37: Object[] params) throws LogicException;
38:
39: /**
40: * Should execute a redirect after business logic execution.
41: *
42: * @return true if redirection should be done
43: */
44: boolean shouldRedirect();
45:
46: /**
47: * Validates this logic.
48: *
49: * @param component
50: * @param context
51: * @param methodParamObjects method parameters
52: * @return the errors
53: * @throws UnstableValidationException
54: */
55: ValidationErrors validate(Object component, LogicRequest context,
56: ResourceBundle bundle, Object[] methodParamObjects)
57: throws UnstableValidationException;
58:
59: Method getMetadata();
60:
61: List<MethodParameter> getParameters();
62:
63: ComponentType getComponentType();
64:
65: }
|