File tree 2 files changed +23
-4
lines changed
src/main/java/io/iworkflow/core
2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change
1
+ package io .iworkflow .core ;
2
+
3
+ // This indicates something goes wrong in the workflow definition
4
+ public class ImplementationException extends RuntimeException {
5
+ public ImplementationException (Throwable cause ) {
6
+ super (cause );
7
+ }
8
+
9
+ public ImplementationException (String message ) {
10
+ super (message );
11
+ }
12
+ }
Original file line number Diff line number Diff line change 1
1
package io .iworkflow .core ;
2
2
3
- import com .google .common .collect .ImmutableMap ;
4
3
import io .iworkflow .core .communication .Communication ;
5
4
import io .iworkflow .core .persistence .Persistence ;
6
5
7
6
import java .io .Serializable ;
8
7
import java .lang .reflect .Method ;
9
- import java .util . Map ;
8
+ import java .lang . reflect . Modifier ;
10
9
11
10
public final class RpcDefinitions {
12
11
private RpcDefinitions () {
@@ -100,12 +99,20 @@ public interface RpcProc0NoPersistence extends Serializable {
100
99
void execute (Context context , Communication communication );
101
100
}
102
101
103
- public static final String ERROR_MESSAGE = "An RPC method must be in the form of one of {@link RpcDefinitions}" ;
102
+ public static final String DEFINITION_ERROR_MESSAGE = "An RPC method must be in the form of one of {@link RpcDefinitions}" ;
103
+
104
+ public static final String FINAL_MODIFIER_ERROR_MESSAGE = "An RPC method must not be final" ;
104
105
105
106
public static void validateRpcMethod (final Method method ) {
106
107
RpcMethodMetadata methodMetadata = RpcMethodMatcher .match (method );
108
+ final boolean isFinal = Modifier .isFinal (method .getModifiers ());
109
+
110
+ if (isFinal ) {
111
+ throw new ImplementationException (FINAL_MODIFIER_ERROR_MESSAGE );
112
+ }
113
+
107
114
if (methodMetadata == null ) {
108
- throw new WorkflowDefinitionException (ERROR_MESSAGE );
115
+ throw new WorkflowDefinitionException (DEFINITION_ERROR_MESSAGE );
109
116
}
110
117
}
111
118
}
You can’t perform that action at this time.
0 commit comments