Package dev.gmitch215.bytebox.json
Annotation Interface JSONType
Generates a JSON codec for this type.
Records are the straightforward case: the components are the fields and the canonical constructor is the decoder. A class works too when it has a no-argument constructor and either public fields or setters.
Nested types need the annotation as well. The generator refuses a field whose type has no codec rather than emitting one that silently reads null, so a missing annotation is a build failure that names the field.
@JSONType
public record Settings(String host, int port, List<String> hosts) {}
- Since:
- 1.0.0
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanWhether to leave out a field holding null rather than writing it asnull.
-
Element Details
-
omitNulls
boolean omitNullsWhether to leave out a field holding null rather than writing it asnull.- Returns:
- whether to omit nulls
- Default:
false
-