java.lang.Object
com.graphql_java_generator.plugin.language.impl.AbstractType
All Implemented Interfaces:
Type
Direct Known Subclasses:
EnumType, ObjectType, ScalarType

public abstract class AbstractType extends Object implements Type
  • Constructor Details

  • Method Details

    • getGraphQlType

      public Type.GraphQlType getGraphQlType()
      Description copied from interface: Type
      The GraphQlType for this type
      Specified by:
      getGraphQlType in interface Type
      Returns:
    • getClassSimpleName

      public String getClassSimpleName()
      The java class simple name for this type. It may be and interface or a concrete class.
      Specified by:
      getClassSimpleName in interface Type
      Returns:
      The java classname is usually the name of the type. But in some case, collision my occur with the Java syntax. In this cas, this method will return a classname different from the name
    • getJavaName

      public String getJavaName()
      Description copied from interface: Type
      The name of the field, as it can be used in the Java code. If the name is a java keyword (class, default, break...), the java name it prefixed by an underscore.
      If a prefix or a suffix has been defined in the plugin configuration for this kind of item (object type, union, enum...), then the java name contains the prefix and/or the suffix
      Specified by:
      getJavaName in interface Type
      Returns:
      The name of the type, as it can be used in Java code
    • getPrefix

      protected String getPrefix()
    • getSuffix

      protected String getSuffix()
    • getCamelCaseName

      public String getCamelCaseName()
      Returns the camel case String, based on the object's name. For instance: bigFoot for a type named BigFoot
      Specified by:
      getCamelCaseName in interface Type
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getAnnotation

      public String getAnnotation()
      Description copied from interface: Type
      Returns the annotation or annotations that must be added to this type.
      Specified by:
      getAnnotation in interface Type
      Returns:
      The relevant annotation(s) ready to add directly as-is in the Velocity template, or "" (an empty string) if there is no annotation to add. The return is never null.
    • setAnnotation

      @Deprecated public void setAnnotation(String annotation)
      Deprecated.
      The annotation setter should be used. Please use the addAnnotation(String) instead
      Parameters:
      annotation - The annotation, that will replace the current one
    • addImport

      public void addImport(String targetPackageName, String classname)
      Description copied from interface: Type
      Add the given class as an import for the current type. This import will be added only if the given class is not in the same package as the java class for this type, and if it doesn't already exist in the imports set.
      classes from the java.lang package are not imported.
      Note1: for inner class, the classname may be "MainClassname$InnerClassname" (as returned by the Class.getName() method), par as "MainClassname.InnerClassname".
      Note2: it is not allowed to import a class of the same name as the current class: there would be a name conflict. In this case, the import "silently fails": the class is not imported in the imports list.
      Specified by:
      addImport in interface Type
      Parameters:
      targetPackageName - The package where the objects are generated
      classname - The full class name (java.lang.String for instance) of the class to import
    • addImportForUtilityClasses

      public void addImportForUtilityClasses(String targetPackageName, String classname)
      Description copied from interface: Type
      Same as #addImport(String, String, String), but for the utility classes
      Specified by:
      addImportForUtilityClasses in interface Type
      Parameters:
      targetPackageName - The package where the objects are generated
      classname - The full class name (java.lang.String for instance) of the class to import
    • addAnnotation

      public void addAnnotation(String annotationToAdd)
      The annotation setter should be added. This method allows to properly manage indentation in the generated source code
      Specified by:
      addAnnotation in interface Type
      Parameters:
      annotationToAdd - The annotation, that will be added to the current one
    • addAnnotation

      public void addAnnotation(String annotationToAdd, boolean replace)
      The annotation setter should be added. This method allows to properly manage indentation in the generated source code
      Specified by:
      addAnnotation in interface Type
      Parameters:
      annotationToAdd - The annotation, that will be added to the current one
    • setComments

      public void setComments(List<graphql.language.Comment> comments)