Skip to content

Commit 97e25ae

Browse files
authored
Custom annotations (#114)
* Support custom annotations in addition to SharedType provided annotations
1 parent 807d093 commit 97e25ae

27 files changed

Lines changed: 1379 additions & 67 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
jobs:
1111
style_check:
12-
runs-on: ubuntu-20.04
12+
runs-on: ubuntu-24.04
1313
steps:
1414
- uses: actions/checkout@v4
1515
- uses: actions/setup-java@v4

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ permissions:
1010

1111
jobs:
1212
release:
13-
runs-on: ubuntu-latest
13+
runs-on: ubuntu-24.04
1414
steps:
1515
- uses: actions/checkout@v4
1616
- uses: actions/setup-java@v4

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub struct User {
4040
* Generics support.
4141
* Constant support.
4242
* Client source dependency is only `@SharedType` retained at source code level.
43-
* SharedType AP jar <150KB, only 2 small dependencies: jsr305 annotations and [mustache](https://github.com/spullara/mustache.java).
43+
* SharedType AP has only 2 small dependencies: jsr305 annotations and [mustache](https://github.com/spullara/mustache.java).
4444
* Parsing takes milliseconds with `-proc:only`.
4545
* Intuitive defaults, put `@SharedType` and there you go. Global + class level options.
4646

@@ -51,6 +51,7 @@ pub struct User {
5151
## Similar Projects
5252
* [bsorrentino/java2typescript](https://github.com/bsorrentino/java2typescript)
5353
* [vojtechhabarta/typescript-generator](https://github.com/vojtechhabarta/typescript-generator)
54+
* [aws/smithy](https://github.com/smithy-lang/smithy)
5455

5556
## Authors
5657
Cause Chung (cuzfrog@gmail.com), Jeremy Zhou (hb.zhou.jeremy@gmail.com)

annotation/src/main/java/online/sharedtype/SharedType.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@
232232
* Mark a method as an accessor regardless of its name.
233233
* Getter prefixes are configured in global properties.
234234
* This annotation will be ignored if {@link #includes()} does not include {@link ComponentType#ACCESSORS}.
235+
* <br>
236+
* Additional annotation types can be configured via global properties.
235237
*/
236238
@Target({ElementType.METHOD})
237239
@Retention(RetentionPolicy.SOURCE)
@@ -247,6 +249,8 @@
247249
* But if this type is referenced directly as type of field or return type of accessor, and "safe-type-resolution" is enabled,
248250
* a compilation error will be reported, unless the field or accessor is also ignored.
249251
* </p>
252+
* <br>
253+
* Additional annotation types can be configured via global properties.
250254
*/
251255
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.TYPE})
252256
@Retention(RetentionPolicy.SOURCE)
@@ -292,6 +296,8 @@
292296
* }
293297
* }
294298
* </pre>
299+
* <br>
300+
* Additional annotation types can be configured via global properties.
295301
*/
296302
@Target({ElementType.FIELD, ElementType.PARAMETER})
297303
@Retention(RetentionPolicy.CLASS)
@@ -312,7 +318,7 @@ enum ComponentType {
312318
* <ul>
313319
* <li>have names same as respective instance fields, aka, fluent getter. This includes record's component accessor.</li>
314320
* <li>start with a getter prefix. By default, prefixes include 'get' or 'is', which can be configured via global properties.</li>
315-
* <li>annotated with {@link Accessor}.</li>
321+
* <li>annotated with {@link Accessor} or any custom annotations configured via global properties.</li>
316322
* </ul>
317323
*/
318324
ACCESSORS,

0 commit comments

Comments
 (0)