Scoop API

scoop:scoop.core:0.1.0

src/serialization_annotations.scoop

Selected production source · src/serialization_annotations.scoop

1/**
2 * Controls derived serialization: rename chooses the external field name, required distinguishes
3 * absence, emitNull preserves absent optionals as null, and ignore excludes a member.
4 */
5@Target([AnnotationTarget.Field, AnnotationTarget.Property, AnnotationTarget.EnumVariant])
6public annotation class Serialize(
7 val rename: String = "",
8 val required: Boolean = false,
9 val emitNull: Boolean = false,
10 val ignore: Boolean = false
13/**
14 * The declaration and type-use positions supported by annotation target restrictions.
15 */
16public enum AnnotationTarget: Int {
17 /**
18 * Allows the annotation on nominal class, struct, enum, interface, or object declarations.
19 */
20 Class = 1,
21 /**
22 * Allows the annotation on annotation declarations.
23 */
24 AnnotationClass = 2,
25 /**
26 * Allows the annotation on an individual enum variant.
27 */
28 EnumVariant = 3,
29 /**
30 * Allows the annotation on stored value fields.
31 */
32 Field = 4,
33 /**
34 * Allows the annotation on a property declaration.
35 */
36 Property = 5,
37 /**
38 * Allows the annotation on function declarations.
39 */
40 Function = 6,
41 /**
42 * Allows the annotation on constructor declarations.
43 */
44 Constructor = 7,
45 /**
46 * Allows the annotation on value parameter declarations.
47 */
48 ValueParameter = 8,
49 /**
50 * Allows the annotation on a property getter.
51 */
52 PropertyGetter = 9,
53 /**
54 * Allows the annotation on a property setter.
55 */
56 PropertySetter = 10,
57 /**
58 * Allows the annotation on type alias declarations.
59 */
60 TypeAlias = 11,
61 /**
62 * Allows the annotation on an individual use of a type in a signature.
63 */
64 Type = 12
67/**
68 * Restricts the declaration or type-use positions where an annotation may be applied.
69 */
70public annotation class Target(val allowed: Array<AnnotationTarget>)
71/**
72 * Allows multiple applications of the annotated annotation type at one target.
73 */
74public annotation class Repeatable
76/**
77 * Selects a host source generator for existing interface implementations.
78 * Each interface string is resolved in the annotated implementation's scope.
79 * Conditional implementations, including inherited ones, keep their original bounds.
80 */
81@Target([AnnotationTarget.Class])
82@Repeatable
83public annotation class GenerateWith(val generator: String, val `interface`: Array<String>)