Class GeneratorContext

java.lang.Object
io.micronaut.starter.application.generator.GeneratorContext
All Implemented Interfaces:
DependencyContext

public class GeneratorContext extends Object implements DependencyContext
A context object used when generating projects.
Since:
1.0.0
Author:
graemerocher
  • Constructor Details

  • Method Details

    • addTemplate

      public void addTemplate(String name, Template template)
      Adds a template.
      Parameters:
      name - The name of the template
      template - The template
    • removeTemplate

      public void removeTemplate(String name)
      Adds a template.
      Parameters:
      name - The name of the template
    • addHelpTemplate

      public void addHelpTemplate(Writable writable)
      Adds a template which will be consolidated into a single help file.
      Parameters:
      writable - The template
    • addHelpLink

      public void addHelpLink(String label, String href)
      Ads a Link to a single help file
      Parameters:
      label - Link's label
      href - Link's uri
    • getBuildProperties

      @NonNull public @NonNull BuildProperties getBuildProperties()
      Returns:
      The build properties
    • getConfiguration

      @NonNull public @NonNull ApplicationConfiguration getConfiguration()
      Returns:
      The configuration
    • getConfiguration

      @Nullable public @Nullable ApplicationConfiguration getConfiguration(String env)
      Parameters:
      env - Environment
      Returns:
      The configuration
    • hasConfigurationEnvironment

      public boolean hasConfigurationEnvironment(@NonNull @NonNull String env)
    • getConfiguration

      @NonNull public @NonNull ApplicationConfiguration getConfiguration(String env, ApplicationConfiguration defaultConfig)
      Parameters:
      env - Environment
      defaultConfig - Default Configuration
      Returns:
      Application Configuration
    • getBootstrapConfiguration

      @Nullable public @Nullable BootstrapConfiguration getBootstrapConfiguration(String env)
      Parameters:
      env - Environment
      Returns:
      The configuration
    • getBootstrapConfiguration

      @NonNull public @NonNull BootstrapConfiguration getBootstrapConfiguration(String env, BootstrapConfiguration defaultConfig)
    • getBootstrapConfiguration

      @NonNull public @NonNull BootstrapConfiguration getBootstrapConfiguration()
      Returns:
      The bootstrap config
    • addConfiguration

      public void addConfiguration(@NonNull @NonNull Configuration configuration)
    • getAllConfigurations

      @NonNull public @NonNull Set<Configuration> getAllConfigurations()
    • getTemplates

      @NonNull public @NonNull Map<String,Template> getTemplates()
      Returns:
      The templates
    • getHelpTemplates

      @NonNull public @NonNull List<Writable> getHelpTemplates()
      Returns:
      The templates
    • getLanguage

      @NonNull public @NonNull Language getLanguage()
      Returns:
      The language
    • getTestFramework

      @NonNull public @NonNull TestFramework getTestFramework()
      Returns:
      The test framework
    • getFramework

      @NonNull public @NonNull String getFramework()
      Returns:
      The framework
    • getBuildTool

      @NonNull public @NonNull BuildTool getBuildTool()
      Returns:
      The build tool
    • getAdditionalOptions

      @NonNull public @NonNull Map<String,Object> getAdditionalOptions()
      Returns:
      A map containing additional options
    • getProject

      @NonNull public @NonNull Project getProject()
      Returns:
      The project
    • getApplicationType

      @NonNull public @NonNull ApplicationType getApplicationType()
      Returns:
      The application type
    • getFeatures

      @NonNull public @NonNull Features getFeatures()
      Returns:
      The selected features
    • getJdkVersion

      @NonNull public @NonNull JdkVersion getJdkVersion()
      Returns:
      The JDK version
    • getOperatingSystem

      @Nullable public @Nullable OperatingSystem getOperatingSystem()
      Returns:
      The current OS
    • applyFeatures

      public void applyFeatures()
    • isFeaturePresent

      public boolean isFeaturePresent(Class<? extends Feature> feature)
    • isFeatureMissing

      public boolean isFeatureMissing(Class<? extends Feature> feature)
    • getFeature

      public <T extends Feature> Optional<T> getFeature(Class<T> feature)
    • getRequiredFeature

      public <T extends Feature> T getRequiredFeature(Class<T> feature)
    • getSourcePath

      public String getSourcePath(String path)
    • getTestSourcePath

      public String getTestSourcePath(String path)
    • parseModel

      protected com.fizzed.rocker.RockerModel parseModel(com.fizzed.rocker.RockerModel javaTemplate, com.fizzed.rocker.RockerModel kotlinTemplate, com.fizzed.rocker.RockerModel groovyTemplate)
    • addTemplate

      public void addTemplate(String name, String path, TestRockerModelProvider testRockerModelProvider)
    • addTemplate

      public void addTemplate(String templateName, String triggerFile, com.fizzed.rocker.RockerModel javaTemplate, com.fizzed.rocker.RockerModel kotlinTemplate, com.fizzed.rocker.RockerModel groovyTemplate)
    • addBuildPlugin

      public void addBuildPlugin(BuildPlugin buildPlugin)
    • resolveCoordinate

      public Coordinate resolveCoordinate(String artifactId)
    • addDependency

      public void addDependency(@NonNull @NonNull Dependency dependency)
      Specified by:
      addDependency in interface DependencyContext
    • getDependencies

      @NonNull public @NonNull Collection<Dependency> getDependencies()
      Specified by:
      getDependencies in interface DependencyContext
    • getBuildPlugins

      public Set<BuildPlugin> getBuildPlugins()
    • getModuleNames

      public Collection<String> getModuleNames()
    • addProfile

      public void addProfile(@NonNull @NonNull Profile profile)
    • getProfiles

      @NonNull public @NonNull Collection<Profile> getProfiles()
    • hasFeature

      public <T extends Feature> boolean hasFeature(Class<T> featureClass)
    • isMicronautFramework

      public boolean isMicronautFramework()
    • hasDependencyInScope

      public boolean hasDependencyInScope(@NonNull @NonNull String groupId, @NonNull @NonNull String artifactId, @NonNull @NonNull Scope scope)
    • hasDependency

      public boolean hasDependency(@NonNull @NonNull String groupId, @NonNull @NonNull String artifactId)
    • countDependencies

      public long countDependencies(@NonNull @NonNull String groupId)