Module aya.cli.impl

Class EitherAdapter

java.lang.Object
org.aya.cli.render.adapter.EitherAdapter
All Implemented Interfaces:
com.google.gson.JsonDeserializer<kala.control.Either<?,?>>, com.google.gson.JsonSerializer<kala.control.Either<?,?>>

public class EitherAdapter extends Object implements com.google.gson.JsonSerializer<kala.control.Either<?,?>>, com.google.gson.JsonDeserializer<kala.control.Either<?,?>>
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    bestMatch(@NotNull com.google.gson.JsonElement json, @NotNull Type type)
    Avoiding deserialize "123" to (Integer) 123 instead of (String) "123"
    kala.control.Either<?,?>
    deserialize(com.google.gson.JsonElement json, Type typeOfT, com.google.gson.JsonDeserializationContext context)
     
    com.google.gson.JsonElement
    serialize(kala.control.Either<?,?> src, Type typeOfSrc, com.google.gson.JsonSerializationContext context)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • EitherAdapter

      public EitherAdapter()
  • Method Details

    • bestMatch

      public static boolean bestMatch(@NotNull @NotNull com.google.gson.JsonElement json, @NotNull @NotNull Type type)
      Avoiding deserialize "123" to (Integer) 123 instead of (String) "123"
      Implementation Note:
      It should not return true for the same with different .
    • serialize

      public com.google.gson.JsonElement serialize(kala.control.Either<?,?> src, Type typeOfSrc, com.google.gson.JsonSerializationContext context)
      Specified by:
      serialize in interface com.google.gson.JsonSerializer<kala.control.Either<?,?>>
    • deserialize

      public kala.control.Either<?,?> deserialize(com.google.gson.JsonElement json, Type typeOfT, com.google.gson.JsonDeserializationContext context) throws com.google.gson.JsonParseException
      Specified by:
      deserialize in interface com.google.gson.JsonDeserializer<kala.control.Either<?,?>>
      Throws:
      com.google.gson.JsonParseException