-
Notifications
You must be signed in to change notification settings - Fork 26
/
ExtraDouble.java
43 lines (39 loc) · 1.21 KB
/
ExtraDouble.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package onactivityresult;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.CLASS;
/**
* parameters of a {@link OnActivityResult} annotated method can be annotated to get a double extra of the Intent<br>
* Example:<br>
* <p>
* <code>
* @OnActivityResult(requestCode = 1)
* void onResult(@ExtraDouble final double extraDouble) {
* // Do something
* }
* </code>
* </p>
* <br>
* extra name: either the value returned by {@link ExtraDouble#name()} or the same as the parameter name<br>
* NOTE: In this case it would be extraDouble<br>
* <br>
* NOTE: If you don't care about the {@link ExtraDouble#defaultValue()} you can also use the {@link Extra} annotation<br>
* <br>
*
* @since 0.3.0
*/
@Retention(CLASS)
@Target(PARAMETER)
public @interface ExtraDouble {
/**
* @return the set default value if the extra is not set on the intent
* @since 0.3.0
*/
double defaultValue() default 0;
/**
* @return the name of the extra parameter which is contained in the Intent
* @since 0.6.0
*/
String name() default "";
}