Skip to content

Commit d546925

Browse files
committed
Fix doc of ReceiverAction
1 parent 2773a13 commit d546925

1 file changed

Lines changed: 21 additions & 14 deletions

File tree

  • AndroidAnnotations/androidannotations-api/src/main/java/org/androidannotations/annotations

‎AndroidAnnotations/androidannotations-api/src/main/java/org/androidannotations/annotations/ReceiverAction.java‎

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,17 @@
2727
* name unless the {@link #value()} field is set.
2828
* </p>
2929
* <p>
30-
* The method could contain any type or parameters.
31-
* </p>
32-
* <p>
3330
* The class MAY contain several {@link ReceiverAction} annotated methods.
3431
* </p>
3532
* <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.
4339
* </p>
40+
*
4441
* <blockquote>
4542
*
4643
* Example :
@@ -50,25 +47,25 @@
5047
* public class MyIntentService extends BroadcastReceiver {
5148
*
5249
* &#064;ReceiverAction
53-
* void mySimpleAction() {
50+
* void mySimpleAction(Intent intent) {
5451
* // ...
5552
* }
5653
*
5754
* &#064;ReceiverAction
58-
* void myAction(String valueString, long valueLong) {
55+
* void myAction(@ReceiverAction.Extra String valueString, Context context) {
5956
* // ...
6057
* }
6158
*
6259
* &#064;ReceiverAction
63-
* void anotherAction(@ReceiverAction.Extra(&quot;specialExtraName&quot;) String valueString, long valueLong) {
60+
* void anotherAction(@ReceiverAction.Extra(&quot;specialExtraName&quot;) String valueString, @ReceiverAction.Extra long valueLong) {
6461
* // ...
6562
* }
6663
* }
6764
* </pre>
6865
*
6966
* </blockquote>
7067
*
71-
* @see EIntentService
68+
* @see EReceiver
7269
*/
7370
@Retention(RetentionPolicy.CLASS)
7471
@Target(ElementType.METHOD)
@@ -82,6 +79,16 @@
8279
*/
8380
String value() default "";
8481

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+
*/
8592
@Retention(RetentionPolicy.CLASS)
8693
@Target(ElementType.PARAMETER)
8794
public @interface Extra {

0 commit comments

Comments
 (0)