|  | 
| 17 | 17 | 
 | 
| 18 | 18 | package com.uber.cadence.activity; | 
| 19 | 19 | 
 | 
|  | 20 | +import com.uber.cadence.workflow.Workflow; | 
| 20 | 21 | import java.lang.annotation.ElementType; | 
| 21 | 22 | import java.lang.annotation.Retention; | 
| 22 | 23 | import java.lang.annotation.RetentionPolicy; | 
| 23 | 24 | import java.lang.annotation.Target; | 
| 24 | 25 | 
 | 
| 25 | 26 | /** | 
| 26 | 27 |  * Indicates that the interface is an activity interface. Only interfaces annotated with this | 
| 27 |  | - * annotation can be used as parameters to {@link | 
| 28 |  | - * com.uber.cadence.workflow.Workflow#newActivityStub(Class)} methods. | 
|  | 28 | + * annotation can be used as parameters to {@link Workflow#newActivityStub(Class)} methods. | 
| 29 | 29 |  * | 
| 30 | 30 |  * <p>Each method of the interface annotated with <code>ActivityInterface</code> including inherited | 
| 31 | 31 |  * from interfaces is a separate activity. By default the name of an activity type is "short | 
| 32 | 32 |  * interface name"_"method name". | 
|  | 33 | + * | 
|  | 34 | + * <p>Example: | 
|  | 35 | + * | 
|  | 36 | + * <pre><code> | 
|  | 37 | + *  public interface A { | 
|  | 38 | + *      a(); | 
|  | 39 | + *  } | 
|  | 40 | + * | 
|  | 41 | + * {@literal @}ActivityInterface | 
|  | 42 | + *  public interface B extends A { | 
|  | 43 | + *     b(); | 
|  | 44 | + *  } | 
|  | 45 | + * | 
|  | 46 | + * {@literal @}ActivityInterface | 
|  | 47 | + *  public interface C extends B { | 
|  | 48 | + *     c(); | 
|  | 49 | + *  } | 
|  | 50 | + * | 
|  | 51 | + *  public class CImpl implements C { | 
|  | 52 | + *      public void a() {} | 
|  | 53 | + *      public void b() {} | 
|  | 54 | + *      public void c() {} | 
|  | 55 | + *  } | 
|  | 56 | + * </code></pre> | 
|  | 57 | + * | 
|  | 58 | + * When <code>CImpl</code> instance is registered with the {@link com.uber.cadence.worker.Worker} the | 
|  | 59 | + * following activities are registered: | 
|  | 60 | + * | 
|  | 61 | + * <p> | 
|  | 62 | + * | 
|  | 63 | + * <ul> | 
|  | 64 | + *   <li>B_a | 
|  | 65 | + *   <li>B_b | 
|  | 66 | + *   <li>C_c | 
|  | 67 | + * </ul> | 
|  | 68 | + * | 
|  | 69 | + * Note that method <code>a()</code> is registered as "B_a" because interface <code>A</code> lacks | 
|  | 70 | + * ActivityInterface annotation. The workflow code can call activities through stubs to <code>B | 
|  | 71 | + * </code> and <code>C</code> interfaces. A call to crate stub to <code>A</code> interface will fail | 
|  | 72 | + * as <code>A</code> is not annotated with ActivityInterface. | 
| 33 | 73 |  */ | 
| 34 | 74 | @Retention(RetentionPolicy.RUNTIME) | 
| 35 | 75 | @Target(ElementType.TYPE) | 
|  | 
0 commit comments