Class TypeMapper

  • All Implemented Interfaces:

    
    public class TypeMapper
    
                        

    Maps GraphQL types to Java types using ViaductSchema.TypeExpr. TypeExpr provides: - baseTypeDef: the base type (String, Int, User, etc.) - baseTypeNullable: is the base type nullable? - listDepth: depth of list nesting (0 = not a list, 1 = List, 2 = List

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      TypeMapper() Creates a TypeMapper that returns simple type names for custom types.
      TypeMapper(String grtPackage) Creates a TypeMapper that returns fully qualified names for custom types.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      String toJavaType(ViaductSchema.TypeExpr<out Object> typeExpr) Maps a ViaductSchema.TypeExpr to its Java representation.
      String toBoxedJavaType(ViaductSchema.TypeExpr<out Object> typeExpr) Maps a ViaductSchema.TypeExpr to its Java representation, always using boxed types for primitives.
      • Methods inherited from class java.lang.Object

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

      • TypeMapper

        TypeMapper()
        Creates a TypeMapper that returns simple type names for custom types.
      • TypeMapper

        TypeMapper(String grtPackage)
        Creates a TypeMapper that returns fully qualified names for custom types.
        Parameters:
        grtPackage - the package name of the GRT types (e.g.
    • Method Detail

      • toJavaType

         String toJavaType(ViaductSchema.TypeExpr<out Object> typeExpr)

        Maps a ViaductSchema.TypeExpr to its Java representation.

        Parameters:
        typeExpr - the type expression
        Returns:

        the Java type string

      • toBoxedJavaType

         String toBoxedJavaType(ViaductSchema.TypeExpr<out Object> typeExpr)

        Maps a ViaductSchema.TypeExpr to its Java representation, always using boxed types for primitives. Use this when the type will appear as a generic type parameter (e.g., inside CompletableFuture or FieldResolverBase).

        Parameters:
        typeExpr - the type expression
        Returns:

        the boxed Java type string