Support ActorMethod to change method's name.#448
Support ActorMethod to change method's name.#448artursouza merged 4 commits intodapr:masterfrom artursouza:actor_method_name
Conversation
| * @return Actor's method return type. | ||
| */ | ||
| Class returns(); | ||
| Class returns() default Void.class; |
There was a problem hiding this comment.
To make this optional, a default value must be provided. On the other hand, null is not allowed in Java for annotation attributes. The best I found was to use Void.class here. The idea is that this is only needed when the result object is Mono, so T can be hinted to the Actor runtime - this is a limitation of the Java programming language that we need to overcome. Providing this default will make this optional when users just want to set name.
There was a problem hiding this comment.
The only other option I could think of would be to declare your own sentinel value.
I'm fine either way.
There was a problem hiding this comment.
I am leaning towards using a sentinel class, called Default for that.
There was a problem hiding this comment.
Created an "internal" class called "Undefined". It reads better now. Please, take a look.
Co-authored-by: Ryan Nowak <nowakra@gmail.com>
| */ | ||
| class ActorProxyImpl implements ActorProxy, InvocationHandler { | ||
|
|
||
| private static final String UNDEFINED_CLASS_NAME = "io.dapr.actors.Undefined"; |
There was a problem hiding this comment.
We cannot refer to the class since it is internal to the package in which it was declared.
Co-authored-by: Ryan Nowak <nowakra@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #448 +/- ##
============================================
- Coverage 83.32% 83.12% -0.20%
- Complexity 858 861 +3
============================================
Files 74 74
Lines 2548 2554 +6
Branches 259 261 +2
============================================
Hits 2123 2123
- Misses 299 302 +3
- Partials 126 129 +3
Continue to review full report at Codecov.
|
Description
Support ActorMethod to change method's name.
Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #444
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: