Class CustomSerializer

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

public class CustomSerializer extends Object
This class contains the data that allows to generate a custom Jackson serializer. These serializers are used to serialize the parameters in the outgoing requests. The serializers exist only for what's not JSON standard, that is: GraphQL Custom Scalars. In the generated code, there is one serializer for each list depth level for this type, that has been encountered in the GraphQL schema.
For instance Date is not a list, and thus has a depth level of 0, whereas [[Date]] is a list of lists, and thus has a depth level of 2.
Author:
etienne-sf
  • Constructor Details

    • CustomSerializer

      public CustomSerializer()
  • Method Details

    • getClassSimpleName

      public String getClassSimpleName()
      Returns the simple name for the serializer class.
      Returns:
      The simple name looks like this: ListListDate, where:
      • ListList shows that this custom scalar is a list serializer. It reads items that are at level 2 of nested GraphQL arrays (= Java list).
      • Date is the GraphQL type name that is managed by this serializer
    • 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:
    • getCustomSerializerClassSimpleName

      public static String getCustomSerializerClassSimpleName(int listLevel, String graphQLTypeName)
      Standard utility to calculate a Custom 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 serializer is. To serialize a value (for custom scalar), the listLevel is 0. To serialize 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: