Merged
Add Retention annotation #31349
huyunhui1Add on Mar 16
Add Retention annotation #31349
Merged
Total: 2 files changed+47-2
| @@ -56,4 +56,49 @@ declare namespace lang { | |||
| 56 | interface ISendable {} | 56 | interface ISendable {} |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | + | ||
| 60 | +/** | ||
| 61 | + * Enum for Retention annotation field type. | ||
| 62 | + * | ||
| 63 | + * @syscap SystemCapability.Utils.Lang | ||
| 64 | + * @stagemodelonly | ||
| 65 | + * @since 24 dynamic | ||
| 66 | + */ | ||
| 67 | +export const enum RetentionPolicy { | ||
| 68 | + /** | ||
| 69 | + * Enumerated value, which is used to identify source annotations. | ||
| 70 | + * | ||
| 71 | + * @syscap SystemCapability.Utils.Lang | ||
| 72 | + * @stagemodelonly | ||
| 73 | + * @since 24 dynamic | ||
| 74 | + */ | ||
| 75 | + SOURCE = 'source', | ||
| 76 | + /** | ||
| 77 | + * Enumerated value, which is used to identify bytecode annotations. | ||
| 78 | + * | ||
| 79 | + * @syscap SystemCapability.Utils.Lang | ||
| 80 | + * @stagemodelonly | ||
| 81 | + * @since 24 dynamic | ||
| 82 | + */ | ||
| 83 | + BYTECODE = 'bytecode' | ||
| 84 | +} | ||
| 85 | + | ||
| 86 | +/** | ||
| 87 | + * An annotation used to annotate the lifecycle of other annotations. | ||
| 88 | + * | ||
| 89 | + * @syscap SystemCapability.Utils.Lang | ||
| 90 | + * @stagemodelonly | ||
| 91 | + * @since 24 dynamic | ||
| 92 | + */ | ||
| 93 | +export @interface Retention { | ||
| 94 | + /** | ||
| 95 | + * Indicates the lifecycle of annotated annotations. | ||
| 96 | + * | ||
| 97 | + * @syscap SystemCapability.Utils.Lang | ||
| 98 | + * @stagemodelonly | ||
| 99 | + * @since 24 dynamic | ||
| 100 | + */ | ||
| 101 | + policy: RetentionPolicy; | ||
| 102 | +} | ||
| 103 | + | ||
| 59 | export default lang; | 104 | export default lang; |
| @@ -57,14 +57,14 @@ import worker, { | |||
| 57 | WorkerEventListener, WorkerEventTarget, WorkerOptions, ThreadWorkerPriority | 57 | WorkerEventListener, WorkerEventTarget, WorkerOptions, ThreadWorkerPriority |
| 58 | } from '@ohos.worker'; | 58 | } from '@ohos.worker'; |
| 59 | import JSON from '@ohos.util.json'; | 59 | import JSON from '@ohos.util.json'; |
| 60 | -import lang from '@arkts.lang'; | 60 | +import lang, { Retention, RetentionPolicy } from '@arkts.lang'; |
| 61 | import ArkTSUtils from '@arkts.utils'; | 61 | import ArkTSUtils from '@arkts.utils'; |
| 62 | export { | 62 | export { |
| 63 | ArrayList, convertxml, DedicatedWorkerGlobalScope, Deque, ErrorEvent, Event, EventListener, | 63 | ArrayList, convertxml, DedicatedWorkerGlobalScope, Deque, ErrorEvent, Event, EventListener, |
| 64 | EventTarget, HashMap, HashSet, LightWeightMap, LightWeightSet, LinkedList, List, MessageEvent, | 64 | EventTarget, HashMap, HashSet, LightWeightMap, LightWeightSet, LinkedList, List, MessageEvent, |
| 65 | MessageEvents, PlainArray, PostMessageOptions, Queue, Stack, ThreadWorkerGlobalScope, TreeMap, | 65 | MessageEvents, PlainArray, PostMessageOptions, Queue, Stack, ThreadWorkerGlobalScope, TreeMap, |
| 66 | TreeSet, Vector, WorkerEventListener, WorkerEventTarget, WorkerOptions, ThreadWorkerPriority, buffer, process, taskpool, | 66 | TreeSet, Vector, WorkerEventListener, WorkerEventTarget, WorkerOptions, ThreadWorkerPriority, buffer, process, taskpool, |
| 67 | - uri, url, util, worker, xml, JSON, lang, ArkTSUtils, collections, stream, Decimal, fastbuffer, | 67 | + uri, url, util, worker, xml, JSON, lang, Retention, RetentionPolicy, ArkTSUtils, collections, stream, Decimal, fastbuffer, |
| 68 | ArrayListComparatorFn, ListComparatorFn | 68 | ArrayListComparatorFn, ListComparatorFn |
| 69 | }; | 69 | }; |
| 70 | 70 | ||