|
| 1 | +/** |
| 2 | + * Copyright (C) 2010-2014 eBusiness Information, Excilys Group |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 5 | + * use this file except in compliance with the License. You may obtain a copy of |
| 6 | + * the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed To in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 | + * License for the specific language governing permissions and limitations under |
| 14 | + * the License. |
| 15 | + */ |
1 | 16 | package org.androidannotations.annotations; |
2 | 17 |
|
| 18 | +import android.content.Intent; |
| 19 | +import android.os.Parcelable; |
| 20 | + |
| 21 | +import java.io.Serializable; |
3 | 22 | import java.lang.annotation.ElementType; |
4 | 23 | import java.lang.annotation.Retention; |
5 | 24 | import java.lang.annotation.RetentionPolicy; |
6 | 25 | import java.lang.annotation.Target; |
7 | 26 |
|
| 27 | +/** |
| 28 | + * <p> |
| 29 | + * Use on any native, {@link Parcelable} or {@link Serializable} parameter of an |
| 30 | + * {@link OnActivityResult} annotated method to bind it with the value from the Intent. |
| 31 | + * </p> |
| 32 | + * <p> |
| 33 | + * The annotation value is the key used for the result data. If not set, the field name |
| 34 | + * will be used as the key. |
| 35 | + * </p> |
| 36 | + * |
| 37 | + * <blockquote> |
| 38 | + * |
| 39 | + * Some usage examples of @Result annotation: |
| 40 | + * |
| 41 | + * <pre> |
| 42 | + * @OnActivityResult(REQUEST_CODE) |
| 43 | + * void onResult(int resultCode, Intent data, <b>@Result String value</b>) { |
| 44 | + * } |
| 45 | + * |
| 46 | + * @OnActivityResult(REQUEST_CODE) |
| 47 | + * void onResult(int resultCode, <b>@Result(value = "key") String value</b>) { |
| 48 | + * } |
| 49 | + * |
| 50 | + * @OnActivityResult(REQUEST_CODE) |
| 51 | + * void onResult(<b>@Result String strVal</b>, <b>@Result int intVal</b>) { |
| 52 | + * } |
| 53 | + * </pre> |
| 54 | + * |
| 55 | + * </blockquote> |
| 56 | + * |
| 57 | + * @see android.app.Activity#onActivityResult(int, int, Intent) |
| 58 | + * @see OnActivityResult |
| 59 | + */ |
| 60 | + |
8 | 61 | @Retention(RetentionPolicy.CLASS) |
9 | 62 | @Target(ElementType.PARAMETER) |
10 | 63 | public @interface Result { |
|
0 commit comments