|
30 | 30 | * </p> |
31 | 31 | * |
32 | 32 | * <p> |
33 | | - * <b>Inner class:</b><br> |
| 33 | + * <b>Inheritance:</b> |
| 34 | + * In different target schemas, inheritance may be transferred differently. |
| 35 | + * <ul> |
| 36 | + * <li>Typescript: Inheritance is mimicked. A subtype's inherited properties will not be included in its own declared properties, |
| 37 | + * while the supertype is also emitted. </li> |
| 38 | + * <li>Rust: Inheritance is not supported. |
| 39 | + * Type hierarchy will be flattened that a subtype's inherited properties will be included in its own declared properties, |
| 40 | + * while, by default, any supertypes will not be emitted again.</li> |
| 41 | + * </ul> |
| 42 | + * </p> |
| 43 | + * |
| 44 | + * <p> |
| 45 | + * <b>Inner classes:</b><br> |
34 | 46 | * Declared inner and nested types will not be included by default, unless they are referenced by other types. |
35 | 47 | * Non-static inner classes are not supported. |
36 | 48 | * </p> |
37 | 49 | * |
38 | 50 | * <p> |
| 51 | + * <b>Cyclic Reference:</b><br> |
| 52 | + * <ul> |
| 53 | + * <li>Rust: Cyclic references will be wrapped in {@code Option<Box<T>>}.</li> |
| 54 | + * </ul> |
| 55 | + * </p> |
| 56 | + * |
| 57 | + * <p> |
| 58 | + * <b>Constants:</b><br> |
| 59 | + * Support is planned in upcoming versions. Only compile-time resolvable values or their combinations are supported. |
| 60 | + * </p> |
| 61 | + * |
| 62 | + * <p> |
39 | 63 | * <b>Generics:</b><br> |
40 | | - * Generics are supported. But it's also limited to target schema's capacity. |
| 64 | + * Generics are supported. But it's also limited to target schema's capacity. Currently, type bounds are not supported. |
41 | 65 | * </p> |
42 | 66 | * |
43 | 67 | * <p> |
44 | 68 | * <b>Collections:</b><br> |
45 | | - * Iterables and arrays are treated as arrays. Map is mapped to: |
| 69 | + * Iterables and arrays are treated as arrays and, by default, are mapped to: |
| 70 | + * <ul> |
| 71 | + * <li>Typescript: {@code T[]}</li> |
| 72 | + * <li>Rust: {@code Vec<T>}</li> |
| 73 | + * </ul> |
| 74 | + * |
| 75 | + * Maps are mapped to: |
| 76 | + * <p> |
| 77 | + * <b>Maps:</b><br> |
| 78 | + * (Not supported yet.) |
46 | 79 | * <ul> |
47 | 80 | * <li>Typescript: {@code [key: string]: T} where {@code T} can be a reified type.</li> |
48 | 81 | * </ul> |
|
52 | 85 | * @author Cause Chung |
53 | 86 | * @implNote generics type bounds are not supported yet, Map is not supported yet. |
54 | 87 | */ |
| 88 | +// TODO: test user-defined array-like types |
55 | 89 | @Retention(RetentionPolicy.SOURCE) |
56 | 90 | @Target({java.lang.annotation.ElementType.TYPE}) |
57 | 91 | @Documented |
|
86 | 120 | */ |
87 | 121 | ComponentType[] includes() default {ComponentType.FIELDS, ComponentType.ACCESSORS, ComponentType.CONSTANTS}; |
88 | 122 |
|
| 123 | + /** |
| 124 | + * Macros to be added to the type in generated Rust code. E.g. "Debug" will generate {@code #[derive](Debug)}. |
| 125 | + * This property only affects this annotated type. By default, "Debug" and "PartialEq" are added to all types, which can be configured via global properties. |
| 126 | + * Resulted macros contain both global default and this property. |
| 127 | + * |
| 128 | + * @return Rust macro traits. E.g. "serde::Serialize". |
| 129 | + */ |
| 130 | + String[] rustMacroTraits() default {}; |
| 131 | + |
89 | 132 | /** |
90 | 133 | * Mark a method as an accessor regardless of its name. |
91 | 134 | * Getter prefixes are configured in global properties. |
|
100 | 143 | * Exclude fields, record components, accessors in a type, or a dependency type, e.g. a supertype. |
101 | 144 | * <p> |
102 | 145 | * <b>When placed on a type:</b> a subtype of this type will not extend this type in target code. |
103 | | - * But if this type is referenced directly as type of a field or return type of an accessor, a compilation error will be reported, |
| 146 | + * But if this type is referenced directly as type of field or return type of accessor, a compilation error will be reported, |
104 | 147 | * unless the field or accessor is also ignored. |
105 | 148 | * </p> |
106 | 149 | */ |
|
0 commit comments