Skip to content

Commit 0f6559e

Browse files
committed
Improve javadoc
1 parent bd9e757 commit 0f6559e

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

jsonb/src/main/java/io/avaje/jsonb/Json.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,31 @@
1010

1111
/**
1212
* Marks a type for JSON support.
13+
*
14+
* <h3>Examples:</h3>
15+
*
16+
* <pre>{@code
17+
*
18+
* @Json(naming = LowerHyphen)
19+
* public class Customer ...
20+
*
21+
* }</pre>
22+
*
23+
* <pre>{@code
24+
*
25+
* @Json
26+
* public record Product( ... )
27+
*
28+
* }</pre>
1329
*/
1430
@Retention(CLASS)
1531
@Target(ElementType.TYPE)
1632
public @interface Json {
1733

1834
/**
1935
* Specify the naming convention to use for the properties on this type.
36+
* <p>
37+
* By default, the naming used is {@link Naming#Match}
2038
*/
2139
Naming naming() default Naming.Match;
2240

@@ -33,6 +51,15 @@
3351
* <p>
3452
* These types are typically in an external project / dependency or otherwise
3553
* types that we can't or don't want to explicitly annotate with {@code @Json}.
54+
* <p>
55+
* Typically, we put this annotation on a package.
56+
*
57+
* <pre>{@code
58+
*
59+
* @Json.Import({Customer.class, Product.class, ...})
60+
* package org.example.processor;
61+
*
62+
* }</pre>
3663
*/
3764
@Retention(CLASS)
3865
@Target({ElementType.TYPE, ElementType.PACKAGE})
@@ -46,6 +73,13 @@
4673

4774
/**
4875
* Override the json property name.
76+
*
77+
* <pre>{@code
78+
*
79+
* @Json.Property("$code")
80+
* String referenceCode;
81+
*
82+
* }</pre>
4983
*/
5084
@Retention(CLASS)
5185
@Target({ElementType.FIELD})

0 commit comments

Comments
 (0)