Class GeneratorConfig

java.lang.Object
com.atlan.generators.GeneratorConfig

public class GeneratorConfig extends Object
Class to encapsulate configuration for the generators.
  • Method Details

    • creator

      public static GeneratorConfig.GeneratorConfigBuilder creator(Class<?> generatorClass, String packageRoot) throws IOException
      Configuration for generating using embedded templates in a jar file.
      Parameters:
      generatorClass - top-level class that is used to generate the code
      packageRoot - root Java package location for the generated models
      Throws:
      IOException - if there is any problem configuring the templates through the classloader
    • creator

      public static GeneratorConfig.GeneratorConfigBuilder creator(Class<?> generatorClass, File directoryForTemplateLoading, String packageRoot) throws IOException
      Configuration for generating using local directory for templates.
      Parameters:
      generatorClass - top-level class that is used to generate the code
      directoryForTemplateLoading - directory containing the Freemarker templates
      packageRoot - root Java package location for the generated models
      Throws:
      IOException - if the directory cannot be accessed
    • creator

      public static GeneratorConfig.GeneratorConfigBuilder creator(Class<?> generatorClass, File directoryForTemplateLoading, String packageRoot, String projectName) throws IOException
      Configuration for generating using local directory for templates.
      Parameters:
      generatorClass - top-level class that is used to generate the code
      directoryForTemplateLoading - directory containing the Freemarker templates
      packageRoot - root Java package location for the generated models
      projectName - (optional) project name for multi-project builds
      Throws:
      IOException - if the directory cannot be accessed
    • getDefault

      public static GeneratorConfig.GeneratorConfigBuilder getDefault(Class<?> generatorClass) throws IOException
      Get the default configuration for the out-of-the-box Atlan model and SDK.
      Parameters:
      generatorClass - top-level class that is used to generate the code
      Returns:
      default configuration
      Throws:
      IOException - if there is any problem configuring the templates through the classloader
    • getDefault

      public static GeneratorConfig.GeneratorConfigBuilder getDefault(Class<?> generatorClass, String projectName) throws IOException
      Get the default configuration for the out-of-the-box Atlan model and SDK.
      Parameters:
      generatorClass - top-level class that is used to generate the code
      projectName - (optional) project name, for multi-project builds
      Returns:
      default configuration
      Throws:
      IOException - if there is any problem configuring the templates through the classloader
    • includeTypedef

      public boolean includeTypedef(TypeDef typeDef)
      Whether to generate information for the given type definition.
      Parameters:
      typeDef - type definition to consider for inclusion
      Returns:
      true if information should be generated for this typedef, otherwise false
    • resolveClassName

      public String resolveClassName(String originalName)
      Resolve the provided name to a class name, renaming it if configured and otherwise just UpperCamelCasing the name.
      Parameters:
      originalName - unmodified name of the type definition
      Returns:
      the resolved name for the POJO class for the type's model
    • forceNonAbstract

      public boolean forceNonAbstract(String originalName)
      Whether to force the creation of a concrete (non-abstract) POJO class for the given type definition.
      Parameters:
      originalName - unmodified name of the type definition
      Returns:
      true if a concrete (non-abstract) POJO should be generated for the type definition
    • resolveAttributeName

      public String resolveAttributeName(String originalName)
      Resolve the provided name to an attribute name, renaming it if configured and otherwise just lowerCamelCasing the name.
      Parameters:
      originalName - unmodified name of the attribute definition
      Returns:
      the resolved name for the attribute in the POJO
    • resolveAttributeToEnumeration

      public String resolveAttributeToEnumeration(String originalName)
      Resolve the type of the attribute to a manually-maintained enumeration, if configured, or return null if there is no enumeration for this attribute.
      Parameters:
      originalName - unmodified name of the attribute definition
      Returns:
      the resolved enumeration name for the attribute in the POJO, or null if not referring to an enumeration
    • resolveAttributeToTypeOverride

      public String resolveAttributeToTypeOverride(String typeName, String attributeName)
      Resolve the type of the attribute to an overridden type, if configured, or return null if there is no type override for this attribute.
      Parameters:
      typeName - unmodified name of the type
      attributeName - unmodified name of the attribute definition
      Returns:
      the resolved type override for the POJO, or null if no override
    • resolveSingular

      public String resolveSingular(String originalName)
      Resolve the attribute to a singular form of it for use with builders (Lombok).
      Parameters:
      originalName - unmodified name of the attribute definition
      Returns:
      the resolved singular form of the word, or an empty string if Lombok can auto-singularize it
    • resolveEnumValue

      public String resolveEnumValue(String value)
      Resolve the enumeration value to an all-caps underscored form to meet Java conventions.
      Parameters:
      value - unmodified value of the enumeration
      Returns:
      the unique name for the enumeration matching Java conventions
    • getSearchableRelationship

      public String getSearchableRelationship(String field)
      Retrieve the relationship type name for any searchable relationship (will be a limited set of the overall relationships).
      Parameters:
      field - name of the relationship attribute in Atlan
      Returns:
      the relationship type name, if the attribute is searchable, otherwise null
    • builder

      public static GeneratorConfig.GeneratorConfigBuilder builder()
    • getFreemarkerConfig

      public freemarker.template.Configuration getFreemarkerConfig()
    • getPackageRoot

      public String getPackageRoot()
    • getPackagePath

      public String getPackagePath()
    • getTestPath

      public String getTestPath()
    • getGeneratorName

      public String getGeneratorName()
    • getPreferTypeDefDescriptions

      public boolean getPreferTypeDefDescriptions()