|
27 | 27 | * name unless the {@link #value()} field is set. |
28 | 28 | * </p> |
29 | 29 | * <p> |
30 | | - * The method could contain any type or parameters. |
31 | | - * </p> |
32 | | - * <p> |
33 | 30 | * The class MAY contain several {@link ReceiverAction} annotated methods. |
34 | 31 | * </p> |
35 | 32 | * <p> |
36 | | - * You MAY use the {@link ReceiverAction.Extra} annotation on parameters to |
37 | | - * define a different extra name. |
38 | | - * </p> |
39 | | - * <p> |
40 | | - * Parameters of type {@link android.content.Intent} or |
41 | | - * {@link android.content.Context} will get the corresponding parameter of |
42 | | - * {@code void onReceive(Context context, Intent intent)} assigned. |
| 33 | + * The method annotated with {@link ReceiverAction} may have as parameters : |
| 34 | + * - A {@link android.content.Context} which will be the context given in {@code void onReceive(Context context, Intent intent)} |
| 35 | + * - A {@link android.content.Intent} which will be the intent given in {@code void onReceive(Context context, Intent intent)} |
| 36 | + * - Some any native, {@link android.os.Parcelable} or {@link java.io.Serializable} parameters |
| 37 | + * annotated with {@link ReceiverAction.Extra} which will be the extra put in the intent. The key of this extra is |
| 38 | + * the value of the annotation {@link ReceiverAction.Extra} if set or the name of the parameter. |
43 | 39 | * </p> |
| 40 | + * |
44 | 41 | * <blockquote> |
45 | 42 | * |
46 | 43 | * Example : |
|
50 | 47 | * public class MyIntentService extends BroadcastReceiver { |
51 | 48 | * |
52 | 49 | * @ReceiverAction |
53 | | - * void mySimpleAction() { |
| 50 | + * void mySimpleAction(Intent intent) { |
54 | 51 | * // ... |
55 | 52 | * } |
56 | 53 | * |
57 | 54 | * @ReceiverAction |
58 | | - * void myAction(String valueString, long valueLong) { |
| 55 | + * void myAction(@ReceiverAction.Extra String valueString, Context context) { |
59 | 56 | * // ... |
60 | 57 | * } |
61 | 58 | * |
62 | 59 | * @ReceiverAction |
63 | | - * void anotherAction(@ReceiverAction.Extra("specialExtraName") String valueString, long valueLong) { |
| 60 | + * void anotherAction(@ReceiverAction.Extra("specialExtraName") String valueString, @ReceiverAction.Extra long valueLong) { |
64 | 61 | * // ... |
65 | 62 | * } |
66 | 63 | * } |
67 | 64 | * </pre> |
68 | 65 | * |
69 | 66 | * </blockquote> |
70 | 67 | * |
71 | | - * @see EIntentService |
| 68 | + * @see EReceiver |
72 | 69 | */ |
73 | 70 | @Retention(RetentionPolicy.CLASS) |
74 | 71 | @Target(ElementType.METHOD) |
|
82 | 79 | */ |
83 | 80 | String value() default ""; |
84 | 81 |
|
| 82 | + |
| 83 | + /** |
| 84 | + * <p> |
| 85 | + * Should be used on any native, {@link android.os.Parcelable} or {@link java.io.Serializable} parameter of a method |
| 86 | + * annotated with {@link ReceiverAction} to inject the extra put in the intent parameter |
| 87 | + * of {@code void onReceive(Context context, Intent intent)}. |
| 88 | + * The key of this extra is the value of the annotation {@link ReceiverAction.Extra} if it is set |
| 89 | + * or the name of the parameter. |
| 90 | + * </p> |
| 91 | + */ |
85 | 92 | @Retention(RetentionPolicy.CLASS) |
86 | 93 | @Target(ElementType.PARAMETER) |
87 | 94 | public @interface Extra { |
|
0 commit comments