Class JsonbIdentityAdapter

java.lang.Object
dev.orne.beans.jsonb.JsonbIdentityAdapter
All Implemented Interfaces:
jakarta.json.bind.adapter.JsonbAdapter<Identity,String>

@API(status=EXPERIMENTAL, since="0.7") public class JsonbIdentityAdapter extends Object implements jakarta.json.bind.adapter.JsonbAdapter<Identity,String>
JSON-B adapter for Identity that converts Identity instances to and from String using the identity token as String representation.
Since:
0.7
Version:
1.0, 2024-03
Author:
(w) Iker Hernaez
  • Constructor Details

    • JsonbIdentityAdapter

      public JsonbIdentityAdapter()
      Creates a new instance.
  • Method Details

    • adaptToJson

      public String adaptToJson(Identity identity) throws Exception
      Serializes specified Identity as a String value.
      Specified by:
      adaptToJson in interface jakarta.json.bind.adapter.JsonbAdapter<Identity,String>
      Parameters:
      identity - The value to be converted. Can be null
      Returns:
      The resulting String instance
      Throws:
      Exception
    • adaptFromJson

      public Identity adaptFromJson(String value) throws Exception
      Parses specified String as a TokenIdentity instance.
      Specified by:
      adaptFromJson in interface jakarta.json.bind.adapter.JsonbAdapter<Identity,String>
      Parameters:
      value - The value to be converted. Can be null
      Returns:
      The resulting TokenIdentity instance
      Throws:
      Exception