Skip to content

Commit

Permalink
Doc fix for polymorphic interfaces (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfateev authored Sep 30, 2020
1 parent 1196386 commit f0bbf84
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public interface ActivityInfo {

String getActivityNamespace();

/** Activity execution attempt starting from 0. */
/** Activity execution attempt starting from 1. */
int getAttempt();

/** Is this activity invoked as a local activity? */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
* annotation can be used as parameters to {@link Workflow#newActivityStub(Class)} methods.
*
* <p>Each method of the interface annotated with <code>ActivityInterface</code> including inherited
* from interfaces is a separate activity. By default the name of an activity type is "short
* interface name"_"method name".
* from interfaces is a separate activity. By default the name of an activity type is its method
* name with the first letter capitalized. Use {@link ActivityInterface#namePrefix()} or {{@link
* ActivityMethod#name()}} to make sure that activity type names are distinct.
*
* <p>Example:
*
Expand All @@ -40,12 +41,12 @@
* a();
* }
*
* {@literal @}ActivityInterface
* {@literal @}ActivityInterface(namePrefix = "B_")
* public interface B extends A {
* b();
* }
*
* {@literal @}ActivityInterface
* {@literal @}ActivityInterface(namePrefix = "C_")
* public interface C extends B {
* c();
* }
Expand All @@ -68,8 +69,7 @@
* <li>C_c
* </ul>
*
* Note that method <code>a()</code> is registered as "B_a" because interface <code>A</code> lacks
* ActivityInterface annotation. The workflow code can call activities through stubs to <code>B
* The workflow code can call activities through stubs to <code>B
* </code> and <code>C</code> interfaces. A call to crate stub to <code>A</code> interface will fail
* as <code>A</code> is not annotated with ActivityInterface.
*/
Expand All @@ -80,6 +80,9 @@
* Prefix to prepend to method names to generate activity types. Default is empty string which
* means that method names are used as activity types.
*
* <p>Note that this value is ignored if a name of an activity is specified explicitly through
* {@link ActivityMethod#name()}.
*
* <p>Be careful about names that contain special characters. These names can be used as metric
* tags. And systems like prometheus ignore metrics which have tags with unsupported characters.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

/**
* Name of the activity type. Default is method name. Also consider using {@link
* ActivityInterface#namePrefix()}.
* ActivityInterface#namePrefix()}. Note that the prefix is ignored if the name is specified.
*
* <p>Be careful about names that contain special characters. These names can be used as metric
* tags. And systems like prometheus ignore metrics which have tags with unsupported characters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
* annotations: {@literal @}WorkflowMethod, {@literal @}SignalMethod or {@literal @}QueryMethod
*
* <p>An interface annotated with WorkflowInterface can extend other interfaces annotated with
* WorkflowInterface having that it can have at most one method annotated with
* WorkflowInterface having that it can have <b>at most one</b> method annotated with
* {@literal @}WorkflowMethod including all inherited methods.
*
* <p>The prefix of workflow, signal and query type names is the name of the declaring interface
* annotated with WorkflowInterface. If a method is declared in non annotated interface the prefix
* comes from the first sub-interface that has the WorkflowInterface annotation.
*
* <p>A workflow implementation object must have exactly one method annotated with
* <p>A workflow implementation object must have <b>exactly one</b> method annotated with
* {@literal @}WorkflowMethod inherited from all the interfaces it implements.
*
* <p>Example:
Expand All @@ -61,7 +61,7 @@
* {@literal @}SignalMethod
* b();
*
* {@literal @}SignalMethod // must to define the type of the inherited method
* {@literal @}SignalMethod // must define the type of the inherited method
* aa();
* }
*
Expand Down Expand Up @@ -92,18 +92,16 @@
* <p>
*
* <ul>
* <li>B_a signal handler
* <li>B_b signal handler
* <li>B_aa signal handler
* <li>C_c workflow main method
* <li>D_d query method
* <li>a signal handler
* <li>b signal handler
* <li>aa signal handler
* <li>c workflow main method
* <li>d query method
* </ul>
*
* Note that methods <code>a()</code> and <code>aa()</code> are registered with "B_" prefix because
* interface <code>A</code> lacks the WorkflowInterface annotation. The client code can call signals
* through stubs to <code>B</code>, <code>C</code> and <code>D</code> interfaces. A call to crate a
* stub to <code>A</code> interface will fail as <code>A</code> is not annotated with the
* WorkflowInterface.
* The client code can call signals through stubs to <code>B</code>, <code>C</code> and <code>D
* </code> interfaces. A call to crate a stub to <code>A</code> interface will fail as <code>A
* </code> is not annotated with the WorkflowInterface.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
Expand Down

0 comments on commit f0bbf84

Please sign in to comment.