Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Commit c7d182d

Browse files
committed
update javadocs for method injection
1 parent 4396b44 commit c7d182d

33 files changed

Lines changed: 216 additions & 64 deletions

File tree

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@
4242
*
4343
* @App
4444
* MyApplication myApp;
45+
*
46+
* @App
47+
* void methodInjection(MyApplication app) {
48+
* // do stuff
49+
* }
50+
*
4551
* }
4652
* </pre>
4753
*

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,24 @@
4242
* &#064;Bean(MyBean2.class)
4343
* MyBean myBean2;
4444
*
45+
* &#064;Bean
46+
* void singleInjection(MyBean bean) {
47+
* // do stuff
48+
* }
49+
*
50+
* &#064;Bean(MyBean2.class)
51+
* void singleInjection2(MyBean bean) {
52+
* // do stuff
53+
* }
54+
*
55+
* void multiInjection(&#064;Bean MyBean bean1, &#064;Bean MyBean bean2) {
56+
* // do stuff
57+
* }
58+
*
59+
* void multiInjection2(&#064;Bean(MyBean2.class) MyBean bean1, &#064;Bean(MyBean2.class) MyBean bean2) {
60+
* // do stuff
61+
* }
62+
*
4563
* }
4664
*
4765
* &#064;EBean

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
* <p>
2525
* Use on any native, {@link android.os.Parcelable Parcelable} or
2626
* {@link java.io.Serializable Serializable} field in an {@link EActivity}
27-
* annotated class to bind it with Android's arguments.
28-
* If <a href="http://parceler.org">Parceler</a> is on the classpath, extras
27+
* annotated class to bind it with Android's arguments. If
28+
* <a href="http://parceler.org">Parceler</a> is on the classpath, extras
2929
* annotated with &#064;Parcel, or collections supported by Parceler will be
3030
* automatically marshaled using a {@link android.os.Parcelable Parcelable}
3131
* through the Parcels utility class.
3232
* </p>
3333
* <p>
34-
* The annotation value is the key used for extra. If not set, the field name
35-
* will be used as the key.
34+
* The annotation value is the key used for extra. If not set, the field or
35+
* method name will be used as the key.
3636
* </p>
3737
* <p>
3838
* When {@link Extra} is used, the intent builder will hold dedicated methods
@@ -68,6 +68,15 @@
6868
* &#064;Extra
6969
* String myMessage;
7070
*
71+
* &#064;Extra
72+
* void singleInjection(String myMessage) {
73+
* // do stuff
74+
* }
75+
*
76+
* void multiInjection(&#064;Extra String myMessage, &#064;Extra String myMessage2) {
77+
* // do stuff
78+
* }
79+
*
7180
* &#064;AfterInject
7281
* void init() {
7382
* Log.d(&quot;AA&quot;, &quot;extra myMessage = &quot; + myMessage);

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
* <p>
2525
* Use on any native, {@link android.os.Parcelable Parcelable} or
2626
* {@link java.io.Serializable Serializable} field in an {@link EFragment}
27-
* annotated class to bind it with Android's arguments.
28-
* If <a href="http://parceler.org">Parceler</a> is on the classpath, extras
27+
* annotated class to bind it with Android's arguments. If
28+
* <a href="http://parceler.org">Parceler</a> is on the classpath, extras
2929
* annotated with &#064;Parcel, or collections supported by Parceler will be
3030
* automatically marshaled using a {@link android.os.Parcelable Parcelable}
3131
* through the Parcels utility class.
3232
* </p>
3333
* <p>
34-
* The annotation value is the key used for argument. If not set, the field name
35-
* will be used as the key.
34+
* The annotation value is the key used for argument. If not set, the field or
35+
* method name will be used as the key.
3636
* </p>
3737
* <p>
3838
* When {@link FragmentArg} is used, the intent builder will hold dedicated
@@ -52,6 +52,15 @@
5252
*
5353
* &#064;FragmentArg
5454
* String myMessage;
55+
*
56+
* &#064;FragmentArg
57+
* void singleInjection(String myMessage) {
58+
* // do stuff
59+
* }
60+
*
61+
* void multiInjection(&#064;FragmentArg String myMessage, &#064;FragmentArg String myMessage2) {
62+
* // do stuff
63+
* }
5564
* }
5665
*
5766
* &#064;EActivity

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@
2222

2323
/**
2424
* <p>
25-
* Use it on android.app.Fragment or android.support.v4.app.Fragment fields in
26-
* activity classes to retrieve and inject a fragment.
25+
* Use it on android.app.Fragment or android.support.v4.app.Fragment fields or
26+
* methods with applicable parameters in activity classes to retrieve and inject
27+
* a fragment.
2728
* </p>
2829
* <p>
29-
* The annotation value should be one of R.id.* fields. If not set, the field
30-
* name will be used as the R.id.* field name.
30+
* The annotation value should be one of R.id.* fields. If not set, the field or
31+
* method name will be used as the R.id.* field name.
3132
* </p>
3233
* <p>
3334
* <b>Note:</b> This can only inject an existing fragment, not create them.
@@ -59,6 +60,15 @@
5960
*
6061
* &#064;FragmentById(R.id.<b>myFragment</b>)
6162
* public MyFragment myFragment2;
63+
*
64+
* &#064;FragmentById
65+
* void singleInjection(MyFragment myFragment) {
66+
* // do stuff
67+
* }
68+
*
69+
* void multiInjection(&#064;FragmentById MyFragment myFragment, &#064;FragmentById(R.id.<b>myFragment</b>) MyFragment myFragment2) {
70+
* // do stuff
71+
* }
6272
* }
6373
* </pre>
6474
*

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@
2222

2323
/**
2424
* <p>
25-
* Use it on android.app.Fragment or android.support.v4.app.Fragment fields in
26-
* activity classes to retrieve and inject a fragment.
25+
* Use it on android.app.Fragment or android.support.v4.app.Fragment fields or
26+
* methods with applicable parameters in activity classes to retrieve and inject
27+
* a fragment.
2728
* </p>
2829
* <p>
29-
* The annotation value should be one of fragment tag. If not set, the field
30-
* name will be used as the tag name.
30+
* The annotation value should be one of fragment tag. If not set, the field or
31+
* method name will be used as the tag name.
3132
* </p>
3233
* <p>
3334
* <b>Note:</b> This can only inject an existing fragment, not create them.
@@ -60,6 +61,15 @@
6061
*
6162
* &#064;FragmentByTag(<b>"myFragmentTag"</b>)
6263
* public MyFragment myFragmentTag2;
64+
*
65+
* &#064;FragmentByTag
66+
* void singleInjection(MyFragment myFragmentTag) {
67+
* // do stuff
68+
* }
69+
*
70+
* void multiInjection(&#064;FragmentByTag MyFragment myFragmentTag, &#064;FragmentById("myFragmentTag") MyFragment myFragment2) {
71+
* // do stuff
72+
* }
6373
* }
6474
* </pre>
6575
*

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* inject the menu.
2727
* </p>
2828
* <p>
29-
* The field MUST be of type {@link android.view.Menu}.
29+
* The field or method parameter MUST be of type {@link android.view.Menu}.
3030
* </p>
3131
*
3232
* <blockquote>
@@ -39,6 +39,11 @@
3939
*
4040
* &#064;InjectMenu
4141
* Menu menu;
42+
*
43+
* &#064;InjectMenu
44+
* void methodInjection(Menu menu) {
45+
* // do stuff
46+
* }
4247
*
4348
* }
4449
* </pre>

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* activity classes to inject a menu item.
2727
* </p>
2828
* <p>
29-
* The field MUST be of type {@link android.view.MenuItem}
29+
* The field or method parameter MUST be of type {@link android.view.MenuItem}
3030
* </p>
3131
* <p>
3232
* The annotation value should be one or several of R.id.* fields. If not set,
@@ -47,6 +47,15 @@
4747
*
4848
* &#064;OptionsMenuItem(R.id.menu_search)
4949
* MenuItem menuItemSearch;
50+
*
51+
* &#064;OptionsMenuItem
52+
* void singleInjection(MenuItem menuRefresh) {
53+
* // do stuff
54+
* }
55+
*
56+
* void multiInjection(&#064;OptionsMenuItem MenuItem menuRefresh, &#064;OptionsMenuItem(R.id.menu_search) MenuItem menuItemSearch) {
57+
* // do stuff
58+
* }
5059
* }
5160
* </pre>
5261
*

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* Use it on a {@link android.preference.Preference Preference} or
2626
* {@link android.preference.Preference Preference} subtype or
2727
* <code>android.support.v7.preference.Preference</code> or
28-
* <code>android.support.v7.preference.Preference</code> subtype fields in a
28+
* <code>android.support.v7.preference.Preference</code> subtype fields or methods with applicable parameters in a
2929
* {@link org.androidannotations.annotations.EActivity EActivity} or
3030
* {@link org.androidannotations.annotations.EFragment EFragment} annotated
3131
* class, which is a subclass of {@link android.preference.PreferenceActivity
@@ -53,6 +53,15 @@
5353
* &#064;PreferenceByKey(R.string.checkBoxPref)
5454
* CheckBoxPreference checkBoxPref;
5555
*
56+
* &#064;PreferenceByKey
57+
* void singleInjection(Preference myPreference1) {
58+
* // do stuff
59+
* }
60+
*
61+
* void multiInjection(&#064;PreferenceByKey Preference myPreference1, &#064;PreferenceByKey(R.string.checkBoxPref) CheckBoxPreference checkBoxPref) {
62+
* // do stuff
63+
* }
64+
*
5665
* &#064;AfterPreferences
5766
* void initPrefs() {
5867
* checkBoxPref.setChecked(false);

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@
5353
* // Only injected if the root context is an instance of MyActivity
5454
* &#064;RootContext
5555
* MyActivity myActivity;
56+
*
57+
* &#064;RootContext
58+
* void singleInjection(Context context) {
59+
* // do stuff
60+
* }
61+
*
62+
* void multiInjection(&#064;RootContext Context context, &#064;RootContext Activity activity) {
63+
* // do stuff
64+
* }
5665
* }
5766
* </pre>
5867
*

0 commit comments

Comments
 (0)