Class TypeNameFormat

java.lang.Object
no.sikt.graphitron.generators.codebuilding.TypeNameFormat

public class TypeNameFormat extends Object
Helper methods for handling javapoet TypeNames.
  • Constructor Details

    • TypeNameFormat

      public TypeNameFormat()
  • Method Details

    • wrapListIf

      public static TypeName wrapListIf(TypeName type, boolean condition)
      Returns:
      The type wrapped in a List ParameterizedTypeName, if the boolean condition is true.
    • wrapSetIf

      public static TypeName wrapSetIf(TypeName type, boolean condition)
      Returns:
      The type wrapped in a Set ParameterizedTypeName, if the boolean condition is true.
    • wrapStringMapIf

      public static TypeName wrapStringMapIf(TypeName type, boolean condition)
      Returns:
      The type wrapped in a Map ParameterizedTypeName with String as key, if the boolean condition is true.
    • wrapList

      public static ParameterizedTypeName wrapList(TypeName type)
      Returns:
      The type wrapped in a List ParameterizedTypeName.
    • wrapArrayList

      public static ParameterizedTypeName wrapArrayList(TypeName type)
      Returns:
      The type wrapped in a ArrayList ParameterizedTypeName.
    • wrapSet

      public static ParameterizedTypeName wrapSet(TypeName type)
      Returns:
      The type wrapped in a Set ParameterizedTypeName.
    • wrapFuture

      public static ParameterizedTypeName wrapFuture(TypeName type)
      Returns:
      The type wrapped in a CompletableFuture ParameterizedTypeName.
    • wrapFetcher

      public static ParameterizedTypeName wrapFetcher(TypeName type)
      Returns:
      The type wrapped in a DataFetcher ParameterizedTypeName.
    • wrapStringMap

      public static ParameterizedTypeName wrapStringMap(TypeName type)
      Returns:
      The type wrapped in a Map ParameterizedTypeName with String as key.
    • wrapMap

      public static ParameterizedTypeName wrapMap(TypeName key, TypeName type)
      Returns:
      The type wrapped in a Map ParameterizedTypeName with key.
    • getStringSetTypeName

      public static ParameterizedTypeName getStringSetTypeName()
      Returns:
      The ParameterizedTypeName for a Set of Strings.
    • getObjectMapTypeName

      public static ParameterizedTypeName getObjectMapTypeName()
      Returns:
      The ParameterizedTypeName for a Map of Objects by Strings.
    • getGeneratedClassName

      public static ClassName getGeneratedClassName(String subPath, String name)
      Parameters:
      subPath - Path from the top of the output package.
      name - Name of the class.
      Returns:
      ClassName based on the default output package and the provided subpath.