Class AnnotationsMapper

java.lang.Object
io.github.besi97.graphql.codegen.mapper.AnnotationsMapper
Direct Known Subclasses:
JavaAnnotationsMapper, KotlinAnnotationsMapper

public abstract class AnnotationsMapper extends Object
Mapper for annotations
  • Constructor Details

    • AnnotationsMapper

      public AnnotationsMapper()
  • Method Details

    • getAnnotations

      public List<String> getAnnotations(MappingContext mappingContext, graphql.language.Type<?> type, graphql.language.NamedNode<?> def, String parentTypeName, boolean mandatory)
      Get annotations for a given GraphQL type
      Parameters:
      mappingContext - Global mapping context
      type - GraphQL type
      def - GraphQL definition
      parentTypeName - Name of the parent type
      mandatory - Type is mandatory
      Returns:
      list of Java annotations for a given GraphQL type
    • getAnnotations

      public List<String> getAnnotations(MappingContext mappingContext, ExtendedDefinition<?,?> extendedDefinition)
    • getAnnotations

      public List<String> getAnnotations(MappingContext mappingContext, String name)
    • getAnnotations

      public List<String> getAnnotations(MappingContext mappingContext, String graphQLTypeName, String name, String parentTypeName, List<graphql.language.Directive> directives, boolean mandatory, graphql.language.NamedNode<?> def)
      Get annotations for a given GraphQL type
      Parameters:
      mappingContext - Global mapping context
      graphQLTypeName - GraphQL type
      name - Name of the GraphQL type
      parentTypeName - Name of the parent type
      directives - List of GraphQL directive
      mandatory - Type is mandatory
      def - GraphQL definition
      Returns:
      list of Java annotations for a given GraphQL type
    • getAnnotationsForDirective

      public List<String> getAnnotationsForDirective(MappingContext mappingContext, List<String> directiveAnnotations, graphql.language.Directive directive)
      Get a list of annotations for a given directive based on mapping config
      Parameters:
      mappingContext - Global mapping context
      directiveAnnotations - List of directive annotations
      directive - GraphQL Directive
      Returns:
      a list of annotations to be added for all types that have given directive
    • getJacksonTypeIdAnnotations

      public List<String> getJacksonTypeIdAnnotations(MappingContext mappingContext, graphql.language.NamedNode<?> def)
      Get Jackson type id resolver annotations
      Parameters:
      mappingContext - Global mapping context
      def - GraphQL definition
      Returns:
      list of Jackson type id resolver annotations
    • getJacksonResolverTypeIdAnnotation

      public abstract String getJacksonResolverTypeIdAnnotation(String modelPackageName)
      Get language specific Jackson type id resolver annotation
      Parameters:
      modelPackageName - Model package name property
      Returns:
      language specific Jackson type id resolver annotation
    • getAdditionalAnnotations

      protected abstract List<String> getAdditionalAnnotations(MappingContext mappingContext, String typeName)
    • addModelValidationAnnotationForType

      public abstract boolean addModelValidationAnnotationForType(String type)
      Whether to add model validation annotation to a type
      Parameters:
      type - GraphQL type name
      Returns:
      true if model validation annotation should be added to a type
    • getValueMapper

      public abstract ValueMapper getValueMapper()