Class CustomDeserializer

java.lang.Object
com.graphql_java_generator.plugin.generate_code.CustomDeserializer

public class CustomDeserializer extends Object
This class contains the data that allows to generate a custom Jackson deserializer. These deserializers are used to deserialize the incoming response. There are two types of custom deserializer:
  • The GraphQL Custom Scalars deserialiser. It takes an input JSON token, and creates the Java instance that match this custom scalar
  • The list Custom deserializer. It can deserialize a JSON list. When dealing with dealing with one level of embedded List (java) or array (GraphQL), it's useless. But GraphQL allows any deep of nested arrays. To manage [[[Human]]], for instance, it's not possible to deserialize it based on Jackson annotation. So the custom List Deserializer takes care of GraphQL arrays, with any level of nested array.
Author:
etienne-sf
  • Constructor Details

    • CustomDeserializer

      public CustomDeserializer()
  • Method Details

    • getClassSimpleName

      public String getClassSimpleName()
      Returns the simple name for the deserializer class.
      Returns:
      The simple name looks like this: ListListDate, where:
      • ListList shows that this custom scalar is a list deserializer. It reads items that are at level 2 of nested GraphQL arrays (= Java list).
      • Date is the simple name for the #javaType of this custom deserializer
    • getJavaClassFullName

      public String getJavaClassFullName()
      Returns The Java type (for instance java.lang.String), that represent the GraphQL type.
      For instance, for a GraphQLType [[String]], the javaClassFullName would contain List<List<java.lang.String>>
      Returns:
    • getCustomDeserializerClassSimpleName

      public static String getCustomDeserializerClassSimpleName(int listLevel, String graphQLTypeName)
      Standard utility to calculate a Custom Deserializer or Serializer name. Used in this class, and to define the Jackson annotation on the field
      Parameters:
      listLevel - Indicates at which level of nested array this custom deserializer is. To deserialize a value (for custom scalar), the listLevel is 0. To deserialize a [[Character]], the listLevel is 2.
      itemClassSimpleName - The class simple name of the item of the list. For instance, for a field that is List<List<Date>>, the itemClassSimpleName would be Date
      Returns: