From ed48481209a974d2350b952c6abbc9754bd2e610 Mon Sep 17 00:00:00 2001 From: Josiah Noel <32279667+SentryMan@users.noreply.github.com> Date: Mon, 29 Jan 2024 01:21:01 -0500 Subject: [PATCH 1/5] PR 51 https://github.com/avaje/website-source/pull/51 --- config/index.html | 1 + http/index.html | 4 +- index.html | 9 +++ inject/index.html | 104 +++++++++++++++++++++++++++- jsonb/index.html | 71 +++++++++++++++++-- spi/index.html | 157 +++++++++++++++++++++++++++++++++++++++++++ validator/index.html | 6 +- 7 files changed, 342 insertions(+), 10 deletions(-) create mode 100644 spi/index.html diff --git a/config/index.html b/config/index.html index 7dde3fd..d72134b 100644 --- a/config/index.html +++ b/config/index.html @@ -553,6 +553,7 @@

Event Logging

+







diff --git a/http/index.html b/http/index.html index 29f4639..ad10162 100644 --- a/http/index.html +++ b/http/index.html @@ -208,8 +208,8 @@

Quick Start

-

2a. JDK 22+

-

In JDK 22+, annotation processors are disabled by default, so we need to add a flag to re-enable.

+

2a. JDK 23+

+

In JDK 23+, annotation processors are disabled by default, so we need to add a flag to re-enable.

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-compiler-plugin</artifactId>
diff --git a/index.html b/index.html
index 8a2a0ac..e5e703e 100644
--- a/index.html
+++ b/index.html
@@ -104,12 +104,21 @@ 

Compile-time libraries for JVM applications

+ + SPI Service + +

+ Zero-dependency library that adds SPI META-INF/services entries for classes and validates module-info provides clauses. +

+ +
+





diff --git a/inject/index.html b/inject/index.html index f52102d..0612e75 100644 --- a/inject/index.html +++ b/inject/index.html @@ -63,6 +63,11 @@
  • @QualifiedMap
  • +
  • Assisted Injection + +
  • Lifecycle
  • Qualifiers @@ -946,7 +947,7 @@

    Set

    Provider

    - A Singleton bean can implement javax.inject.Provider<T> to create a bean to + A Singleton bean can implement (javax/jakarta).inject.Provider<T> to create a bean to be used in injection.

    @Singleton
    @@ -1216,6 +1217,55 @@ 

    @Prototype

    }
    + +

    @Lazy

    +

    + We can use @Lazy on beans/factory methods to defer bean initialization until the annotated bean is requested. +

    + +
    @Lazy
    +public class Sloth {
    +
    +  private final Moss moss;
    +
    +  @Inject //this will not be called until the bean is requested
    +  Sloth(Moss moss) {
    +    this.moss = moss;
    +  }
    +}
    +
    +
    +

    + There are two ways to lazily load the bean. +

    +

    1. Directly retrieve from the bean scope:

    +
    final var scope = BeanScope.builder().build();
    +scope.get(Sloth.class); //Sloth is initialized here
    +
    +
    + +

    2. Use a Provider

    + +

    Unlike regular provider beans, the providers for lazy beans will return the same singleton instance.

    + +
    @Singleton
    +class UseSloth  {
    +
    +  private final Provider<Sloth> slothProvider;
    +
    +  UseFoo(Provider<Sloth> slothProvider) {
    +    this.slothProvider = slothProvider;
    +  }
    +
    +  void doStuff() {
    +
    +    // get the singleton Sloth instance and use it
    +    Sloth sloth = slothProvider.get();
    +    ...
    +  }
    +}
    +
    +

    Qualifiers

    @Named

    diff --git a/jsonb/index.html b/jsonb/index.html index fed7008..0bfa4a9 100644 --- a/jsonb/index.html +++ b/jsonb/index.html @@ -30,18 +30,32 @@
  • @Json
  • +
  • @Import +
  • +
  • @Raw +
  • +
  • @Property +
  • +
  • @Alias +
  • +
  • @Creator +
  • +
  • @Ignore +
  • +
  • @Unmapped +
  • +
  • @Value + +
  • +
  • @Mixin +
  • +
  • @Subtype +
  • @CustomAdapter
  • @@ -62,63 +76,67 @@ -

    Avaje Jsonb

    - - - - - - - - - - - - - - - - -
    DiscordSourceAPI DocsIssuesReleases
    DiscordGithubJavadocGithub
    - -



    - This is a light (~200kb + generated code), fast, and reflection free Json binding library -

    - - - -

    Default Supported Types

    +

    Avaje Jsonb

    + + + + + + + + + + + + + + + + +
    DiscordSourceAPI DocsIssuesReleases
    DiscordGithubJavadoc + Github
    + +



    + This is a light (~200kb + generated code), fast, and reflection free Json binding library +

    -

    - Jsonb has built-in support for reading and writing Java’s core data types: -

    - - + + +

    Default Supported Types

    +

    + Jsonb has built-in support for reading and writing Java’s core data types: +

    -

    Quick Start

    -

    - 1. Add avaje-jsonb dependencies. -

    -
    <dependency>
    +  
      +
    • Primitives (int, float, char...) and their boxed counterparts (Integer, Float, Character...).
    • +
    • BigInteger and BigDecimal
    • +
    • java.time classes (Instant, LocalDate, LocalDateTime...)
    • +
    • Arrays, Collections, Streams, Lists, Sets, and Maps
    • +
    • Strings
    • +
    • Enums
    • +
    • Other miscellaneous types (UUID, URL, URI)
    • +
    + + +

    Quick Start

    +

    + 1. Add avaje-jsonb dependencies. +

    +
    <dependency>
       <groupId>io.avaje</groupId>
       <artifactId>avaje-jsonb</artifactId>
       <version>${avaje.jsonb.version}</version>
    @@ -132,10 +150,10 @@ 

    -

    -2. Add the annotation processor to your pom. -

    -
    <!-- Annotation processors -->
    +  

    + 2. Add the annotation processor to your pom. +

    +
    <!-- Annotation processors -->
     <dependency>
       <groupId>io.avaje</groupId>
       <artifactId>avaje-jsonb-generator</artifactId>
    @@ -146,7 +164,7 @@ 

    - -

    3. Add @Json onto types we want to serialize.

    -

    -
    The avaje-jsonb-generator annotation processor will generate a JsonAdapter as java source code for each type annotated with @Json. - These will be automatically registered with Jsonb using a service loader mechanism. -
    For types we can not annotate with @Json we can instead use @Json.Import. -

    -
    @Json
    +  

    3. Add @Json onto types we want to serialize.

    +

    +
    The avaje-jsonb-generator annotation processor will generate a JsonAdapter as java source code for each type + annotated with @Json. + These will be automatically registered with Jsonb using a service loader mechanism. +
    For types we can not annotate with @Json we can instead use @Json.Import. +

    +
    @Json
     public class Address {
       private String street;
       private String suburb;
    @@ -177,18 +196,18 @@ 

    3. Add @Json onto types we want to serialize.

    -

    Also works with records:

    +

    Also works with records:

    -
    @Json
    +  
    @Json
     public record Address(String street, String suburb, String city){}
     
    -

    - 4. Serialize/Deserialize your JSON/POJO -

    +

    + 4. Serialize/Deserialize your JSON/POJO +

    -
    // build using defaults
    +  
    // build using defaults
     Jsonb jsonb = Jsonb.builder().build();
     
     JsonType<Customer> customerType = jsonb.type(Customer.class);
    @@ -206,33 +225,35 @@ 

    -

    - 5. JsonViews -

    -

    This library supports dynamic json views which allow us to specify which specific properties to include when serialising to json.

    +

    + 5. JsonViews +

    +

    This library supports dynamic json views which allow us to specify which specific properties to include when + serialising to json.

    -
    Jsonb jsonb = Jsonb.builder().build();
    +  
    Jsonb jsonb = Jsonb.builder().build();
     
     JsonType<Customer> customerType = jsonb.type(Customer.class);
     
     // only including the id and name
     JsonView<Customer> idAndNameView = customerType.view("(id, name)");
     
    -String asJson =  idAndNameView.toJson(customer);
    +String asJson = idAndNameView.toJson(customer);
     
     JsonView<Customer> myView =
       customerType.view("(id, name, billingAddress(*), contacts(lastName, email))");
     
     // serialize to json the above specified properties only
    -String asJson =  myView.toJson(customer);
    +String asJson = myView.toJson(customer);
     

    Spring/Avaje Inject Integration

    - When used with Spring or Avaje Inject, a default Jsonb instance will be provided and used for serializing/deserializing Http messages. The following properties can be added to configure the default instance. + When used with Spring or Avaje Inject, a default Jsonb instance will be provided and used for + serializing/deserializing Http messages. The following properties can be added to configure the default instance. -

    jsonb.deserialize.failOnUnknown (default false)
    +  
    jsonb.deserialize.failOnUnknown (default false)
     jsonb.serialize.mathTypesAsString (default false)
     jsonb.serialize.empty (default true)
     jsonb.serialize.nulls (default false)
    @@ -266,30 +287,34 @@ 
    Example module-info

    - In the example above, org.example.jsonb.GeneratedComponent is generated code typically found in + In the example above, org.example.jsonb.GeneratedComponent is generated code typically found in target/generated-sources/annotations.

    -

    @Json

    -

    -Types with @Json are picked up by avaje-jsonb-generator at compile time and a JsonAdapter is generated as java source code typically in target/generated-sources/annotations. -

    -

    Constructors

    -

    - The types can be a record/class and have constructors. When types do not have a default constructor (e.g. record types) then the generated code will use the constructor. Fields in the constructor do not need or use setter methods. -

    +

    @Json

    +

    + Types with @Json are picked up by avaje-jsonb-generator at compile time and a JsonAdapter is generated + as java source code typically in target/generated-sources/annotations. +

    +

    Constructors

    +

    + The types can be a record/class and have constructors. When types do not have a default constructor (e.g. record + types) then the generated code will use the constructor. Fields in the constructor do not need or use setter + methods. +

    -
    //Example record - all fields set via constructor
    +  
    //Example record - all fields set via constructor
     @Json
     public record Address(String street, String suburb, String city) { }
     
    -

    -All the fields of record types are set via constructor - no setters here. -

    -When a class has a constructor like the City example below, then fields in the constructor do not need or use a setter method. We only need a setter method for fields that are not in the constructor. -

    -
    @Json
    +  

    + All the fields of record types are set via constructor - no setters here. +

    + When a class has a constructor like the City example below, then fields in the constructor do not need or use a + setter method. We only need a setter method for fields that are not in the constructor. +

    +
    @Json
     public class City {
       UUID id;
       String name;
    @@ -308,16 +333,17 @@ 

    Constructors

    -

    - In the example above the id and name fields are set via constructor - and only zone is set via setter method. -

    +

    + In the example above the id and name fields are set via constructor + and only zone is set via setter method. +

    -

    Setter methods

    -

    - Fields that are not set via the constructor need to have a setter methods. There are 4 styles of setter methods that avaje-jsonb-generator will find. -

    -
    // traditional setter
    +  

    Setter methods

    +

    + Fields that are not set via the constructor need to have a setter methods. There are 4 styles of setter methods that + avaje-jsonb-generator will find. +

    +
    // traditional setter
     public void setSuburb(String suburb) {
       this.suburb = suburb;
     }
    @@ -338,20 +364,20 @@ 

    Setter methods

    -

    Naming Convention

    -

    - We can specify a naming convention via the naming attribute of @Json. - This naming convention translates field names to json property names. - The result of changing the naming convention can be seen in the generated JsonAdapter code. -

    -
    @Json(naming = LowerHyphen)
    +  

    Naming Convention

    +

    + We can specify a naming convention via the naming attribute of @Json. + This naming convention translates field names to json property names. + The result of changing the naming convention can be seen in the generated JsonAdapter code. +

    +
    @Json(naming = LowerHyphen)
     public class Customer {
     ...
     }
     
    -
    //The Naming options are below with the default of Match.
    +  
    //The Naming options are below with the default of Match.
     enum Naming {
       Match,
       LowerHyphen,
    @@ -365,9 +391,9 @@ 

    Naming Convention

    -

    Generated JsonAdapter

    -

    Given the class:

    -
    @Json
    +  

    Generated JsonAdapter

    +

    Given the class:

    +
    @Json
     public class Address {
       private String street;
       private City city;
    @@ -376,10 +402,10 @@ 

    Generated JsonAdapter

    }
    -

    The following JsonAdapter is generated:

    -
    - Generated Code: (click to expand) -
    @Generated
    +  

    The following JsonAdapter is generated:

    +
    + Generated Code: (click to expand) +
    @Generated
     public final class AddressJsonAdapter implements JsonAdapter<Address>, ViewBuilderAware {
     
       private final JsonAdapter<String> stringJsonAdapter;
    @@ -457,53 +483,55 @@ 

    Generated JsonAdapter

    }
    -
    - -

    @Json.Import

    -

    When we are unable to or do not wish to put @Json on the types we can use @Json.Import. -

    -We can put @Json.Import on a package or type and specify the types to generate a JsonAdapter for. -

    -
    @Json.Import({Customer.class, Address.class, Order.class})
    +  
    + +

    @Json.Import

    +

    When we are unable to or do not wish to put @Json on the types we can use @Json.Import. +

    + We can put @Json.Import on a package or type and specify the types to generate a JsonAdapter for. +

    +
    @Json.Import({Customer.class, Address.class, Order.class})
     package org.example;
     
    -

    @Json.Raw

    -

    -We can use @Json.Raw to mark a String field as containing raw JSON content. This is then read and written (as a string containing raw json). -

    +

    @Json.Raw

    +

    + We can use @Json.Raw to mark a String field as containing raw JSON content. This is then read and + written (as a string containing raw json). +

    -
    @Json.Raw
    +  
    @Json.Raw
     String rawJson
     
    -

    @Json.Property

    -

    -We can override the serialization/deserialization name of a field using @Json.Property. -

    +

    @Json.Property

    +

    + We can override the serialization/deserialization name of a field using @Json.Property. +

    -
    @Json
    +  
    @Json
     public class Customer {
     
       @Json.Property("SomeOtherName")
    -  private name
    +  private String name;
       ...
     }
     
    -

    - Effectively, we have renamed this property and will not be able to deserialize this from a json of {"name":"Jolyne"}. - It will now only deserialize for the new name. {"SomeOtherName":"Jolyne"}. -
    If you wish to only specify an alias for the json property, use @Alias. -

    - -

    Generated Code

    +

    + Effectively, we have renamed this property and will not be able to deserialize this from a json of + {"name":"Jolyne"}. + It will now only deserialize for the new name. {"SomeOtherName":"Jolyne"}. +
    If you wish to only specify an alias for the json property, use @Alias. +

    -

    @Json.Property makes the following changes to the generated JsonAdapter:

    -
    @Generated
    +  
    + Generated Code: (click to expand) +

    @Json.Property makes the following changes to the generated JsonAdapter:

    +
    @Generated
     public final class CustomerJsonAdapter implements JsonAdapter<Customer>, ViewBuilderAware {
     
       ...
    @@ -541,14 +569,16 @@ 

    Generated Code

    }
    +
    -

    @Json.Alias

    +

    @Json.Alias

    -

    - We can define a deserialization alias for a field using @Json.Alias. It is compatible with, and can work in tandem with @Property -

    +

    + We can define a deserialization alias for a field using @Json.Alias. It is compatible with, and can + work in tandem with @Property +

    -
    @Json
    +  
    @Json
     public class Customer {
     
       @Alias({"SomeOtherName","SomeOtherName2"})
    @@ -558,10 +588,10 @@ 

    @Json.Alias

    -

    Generated Code

    - -

    @Json.Alias makes the following changes to the generated JsonAdapter:

    -
    @Generated
    +  
    + Generated Code: (click to expand) +

    @Json.Alias makes the following changes to the generated JsonAdapter:

    +
    @Generated
     public final class CustomerJsonAdapter implements JsonAdapter<Customer>, ViewBuilderAware {
     
       ...
    @@ -593,13 +623,15 @@ 

    Generated Code

    }
    +
    -

    @Json.Creator

    -

    - With @Json.Creator, we can override deserialization using a constructor or static factory method. Contructor/Method parameters can be annotated with @Alias to rename a deserialization field. -

    +

    @Json.Creator

    +

    + With @Json.Creator, we can override deserialization using a constructor or static factory method. + Contructor/Method parameters can be annotated with @Alias to rename a deserialization field. +

    -
    @Json
    +  
    @Json
     public record Kingfisher(@Json.Alias("species") String name, int fishCaught) {
     
       @Json.Creator
    @@ -610,10 +642,10 @@ 

    @Json.Creator

    -

    Generated Code

    - -

    @Json.Creator makes the following changes to the generated JsonAdapter:

    -
    @Generated
    +  
    + Generated Code: (click to expand) +

    @Json.Creator makes the following changes to the generated JsonAdapter:

    +
    @Generated
     public final class KingfisherJsonAdapter implements JsonAdapter<Kingfisher>, ViewBuilderAware {
     
       ...
    @@ -651,14 +683,14 @@ 

    Generated Code

    }
    +
    +

    @Json.Ignore

    +

    + We can exclude a field from json serialisation using @Json.Ignore +

    -

    @Json.Ignore

    -

    - We can exclude a field from json serialisation using @Json.Ignore -

    - -
    @Json
    +  
    @Json
     public class Secrets {
     
       @Json.Ignore private String mySecret;
    @@ -676,10 +708,10 @@ 

    @Json.Ignore

    -

    Generated Code

    - -

    @Json.Ignore makes the following changes to the generated JsonAdapter:

    -
    @Generated
    +  
    + Generated Code: (click to expand) +

    @Json.Ignore makes the following changes to the generated JsonAdapter:

    +
    @Generated
     public final class SecretsJsonAdapter implements JsonAdapter<Secrets>, ViewBuilderAware {
     
       ...
    @@ -728,15 +760,17 @@ 

    Generated Code

    +
    -

    @Json.Unmapped

    -

    -We can use @Json.Unmapped to collect unmapped json during de-serialization and include it in serialization. -

    -The @Json.Unmapped annotation must be on a field of type Map -

    +

    @Json.Unmapped

    +

    + We can use @Json.Unmapped to collect unmapped json during de-serialization and include it in + serialization. +

    + The @Json.Unmapped annotation must be on a field of type Map +

    -
    @Json
    +  
    @Json
     public class UnmappedJson {
       private String mapped;
       @Json.Unmapped private Map<String, Object> unmapped;
    @@ -744,10 +778,10 @@ 

    @Json.Unmapped

    -

    Generated Code

    - -

    @Json.Unmapped makes the following changes to the generated JsonAdapter:

    -
    @Generated
    +  
    + Generated Code: (click to expand) +

    @Json.Unmapped makes the following changes to the generated JsonAdapter:

    +
    @Generated
     public final class UnmappedJsonJsonAdapter implements JsonAdapter<UnmappedJson>, ViewBuilderAware {
     
       ...
    @@ -796,16 +830,76 @@ 

    Generated Code

    }
    +
    -

    Enum Mapping with @Json.Value

    +

    @Json.Value

    +

    + We can use @Json.Value to specify a method that will provide the value used to serialize to/from json. +

    +

    -

    -We can use @Json.Value on Enum types to specify a method that provides the values that will be used to serialize to/from json. This works for any type that can be compared with .equals() -

    -In the example below the values used in the json content is "one value" and "two value" rather than the usual "ONE" and "TWO". -

    +

    Inlining Classes

    -
    public enum MyEnum {
    +  

    + When using @Json.Value on a class method, a special adapter is generated that will use this value to + (de)serialize. +

    + In the example below, the class is serialized as it were a String object. +

    + +
    public class Inlined {
    +  private final String value;
    +  private final int otherValue; //notUsed
    +
    +  public Inlined(String value) {
    +    this.value = value;
    +  }
    +
    +  @Json.Value
    +  public String value() {
    +    return value;
    +  }
    +}
    +
    +
    +
    + Generated Code: (click to expand) +

    The specialized adapter generated to (de)serialize the object:

    +
    @Generated
    +public final class InlinedJsonAdapter implements JsonAdapter<Inlined> {
    +
    +  private final JsonAdapter<String> adapter;
    +
    +  public InlinedJsonAdapter(Jsonb jsonb) {
    +    this.adapter = jsonb.adapter(String.class);
    +  }
    +
    +  @Override
    +  public void toJson(JsonWriter writer, Inlined value) {
    +    adapter.toJson(writer, value.value());
    +  }
    +
    +  @Override
    +  public Inlined fromJson(JsonReader reader) {
    +    return new Inlined(adapter.fromJson(reader));
    +  }
    +}
    +
    +
    +
    + +

    Enum Mapping with @Json.Value

    + +

    + When using @Json.Value with Enum methods, a specialized adapter using an EnumMap will be + generated to cache the constant values for (de)serialization. This works for any method return type that can be + compared with .equals() +

    + In the example below the values used in the json content is "one value" and "two value" rather than the usual "ONE" + and "TWO". +

    + +
    public enum MyEnum {
     
       ONE("one value"),
       TWO("two value");
    @@ -824,11 +918,9 @@ 

    Enum Mapping with @Json.Value

    -

    Generated Code

    - -

    A specialized adapter is generated to handle the enum mapping

    - -
    @Generated
    +  
    + Generated Code: (click to expand) +
    @Generated
     public final class MyEnumJsonAdapter implements JsonAdapter<MyEnum> {
     
       private static final Map<MyEnum, String> toValue = new EnumMap<>(MyEnum.class);
    @@ -862,16 +954,17 @@ 

    Generated Code

    }
    +
    +

    @Json.Mixin

    -

    @Json.Mixin

    - -

    - Mark this Class as a MixIn Type that can add Jsonb Annotations on the specified type. -
    - Say we want to override the field serialization behavior on a class we can't modify.(Typically in an external project/dependency or otherwise) -

    +

    + Mark this Class as a MixIn Type that can add Jsonb Annotations on the specified type. +
    + Say we want to override the field serialization behavior on a class we can't modify.(Typically in an external + project/dependency or otherwise) +

    -
    public class MixinTarget {
    +  
    public class MixinTarget {
       private String name;
       private String stand;
       private String bandReference;
    @@ -879,8 +972,8 @@ 

    @Json.Mixin

    }
    -

    We can use the @Json.Mixin annotation on an abstract class to effectively add @Json Annotations

    -
    @Json.MixIn(MixinTarget.class)
    +  

    We can use the @Json.Mixin annotation on an abstract class to effectively add @Json Annotations

    +
    @Json.MixIn(MixinTarget.class)
     public abstract class MixinClass {
     
       @Json.Property("part")
    @@ -892,11 +985,11 @@ 

    @Json.Mixin

    -

    Generated Code

    - -

    @Json.Mixin makes the following changes to the generated MixinTargetJsonAdapter:

    +
    + Generated Code: (click to expand) +

    @Json.Mixin makes the following changes to the generated MixinTargetJsonAdapter:

    -
    @Generated
    +    
    @Generated
     public final class MixinTargetJsonAdapter implements JsonAdapter<MixinTarget>, ViewBuilderAware {
     
       ...
    @@ -951,16 +1044,20 @@ 

    Generated Code

    }
    +
    -

    @Json.Subtype

    +

    @Json.Subtype

    -

    For mapping polymorphic types we specify on the parent type a @Json.Subtype for each concrete sub-type that can represent that type. +

    For mapping polymorphic types we specify on the parent type a @Json.Subtype for each concrete sub-type + that can represent that type. -

    By default the "type property" that specifies the type in json is "@type". Use @Json(typeProperty=...) to specify the name of the type property.

    +

    By default the "type property" that specifies the type in json is "@type". Use + @Json(typeProperty=...) to specify the name of the type property. +

    -Note: There is a current limitation that polymorphic types do not yet support "Json Views".

    + Note: There is a current limitation that polymorphic types do not yet support "Json Views".

    -
    @Json
    +  
    @Json
     @Json.SubType(type = Car.class, name = "CAR")
     @Json.SubType(type = Truck.class, name = "TRUCK")
     public abstract class Vehicle {
    @@ -985,9 +1082,9 @@ 

    @Json.Subtype

    -

    Additionally, you can deserialize the typeProperty to an enum.

    +

    Additionally, you can deserialize the typeProperty to an enum.

    -
    enum TypeEnum {
    +  
    enum TypeEnum {
       CAR,
       TRUCK;
     }
    @@ -1003,11 +1100,11 @@ 

    @Json.Subtype

    -

    Generated Code

    +
    + Generated Code: (click to expand) +

    Given this class:

    -

    Given this class:

    - -
    @Json
    +    
    @Json
     @Json.SubType(type = Car.class)
     @Json.SubType(type = Truck.class, name = "TRUCK")
     public abstract class Vehicle {
    @@ -1027,9 +1124,8 @@ 

    Generated Code

    -

    The below adapter will be generated:

    - -
    @Generated
    +    

    The below adapter will be generated:

    +
    @Generated
     public final class VehicleJsonAdapter implements JsonAdapter<Vehicle> {
     
       private final JsonAdapter<String> stringJsonAdapter;
    @@ -1119,16 +1215,19 @@ 

    Generated Code

    }
    +
    -

    @CustomAdapter

    -

    - With @CustomAdapter, you can define your own JsonAdapter for your more esoteric serialization needs. - A custom adapter registered using this annotation must have a public constructor accepting a Jsonb instance (or a public static JsonAdapter.Factory FACTORY field for generic adapters), and must directly implement the JsonAdapter Interface. -

    +

    @CustomAdapter

    +

    + With @CustomAdapter, you can define your own JsonAdapter for your more esoteric serialization needs. + A custom adapter registered using this annotation must have a public constructor accepting a Jsonb instance (or a + public static JsonAdapter.Factory FACTORY field for generic adapters), and must directly implement the + JsonAdapter Interface. +

    -

    Standard Adapters

    +

    Standard Adapters

    -
    @CustomAdapter
    +  
    @CustomAdapter
     public class CustomClassJsonAdapter implements JsonAdapter<CustomClass> {
     
       private final JsonAdapter<String> stringJsonAdapter;
    @@ -1147,9 +1246,9 @@ 

    Standard Adapters

    -

    Generic Adapters

    +

    Generic Adapters

    -
    @CustomAdapter(isGeneric = true)
    +  
    @CustomAdapter(isGeneric = true)
     public class CustomGenericClassJsonAdapter<T> implements JsonAdapter<GenericClass<T>> {
     
       private final JsonAdapter<T> TAdapter;
    @@ -1175,7 +1274,7 @@ 

    Generic Adapters

    -







    +