Class InitializrConfiguration

java.lang.Object
io.spring.initializr.metadata.InitializrConfiguration
Direct Known Subclasses:
InitializrProperties

public class InitializrConfiguration extends Object
Various configuration options used by the service.
Author:
Stephane Nicoll, Chris Bono, Moritz Halbritter
  • Constructor Details

    • InitializrConfiguration

      public InitializrConfiguration()
  • Method Details

    • getEnv

      public InitializrConfiguration.Env getEnv()
    • validate

      public void validate()
      Validate this configuration.
      Throws:
      InvalidInitializrMetadataException - if the configuration is invalid
    • merge

      public void merge(InitializrConfiguration other)
      Merge the given configuration into this one.
      Parameters:
      other - the configuration to merge
    • generateApplicationName

      public String generateApplicationName(@Nullable String name)
      Generate a suitable application name based on the specified name. If no suitable application name can be generated from the specified name, the InitializrConfiguration.Env.getFallbackApplicationName() is used instead.

      No suitable application name can be generated if the name is null or if it contains an invalid character for a class identifier.

      Parameters:
      name - the the source name
      Returns:
      the generated application name
      See Also:
    • isValidApplicationName

      public boolean isValidApplicationName(String name)
      Checks whether the given name is a valid application name.
      Parameters:
      name - the name to check
      Returns:
      whether the name is a valid application name
    • cleanPackageName

      public String cleanPackageName(@Nullable String packageName, @Nullable Language language, String defaultPackageName)
      Clean the specified package name if necessary. If the package name cannot be transformed to a valid package name, the defaultPackageName is used instead.

      The package name cannot be cleaned if the specified packageName is null or if it contains an invalid character for a class identifier.

      Parameters:
      packageName - the package name
      language - the project language
      defaultPackageName - the default package name
      Returns:
      the cleaned package name
      See Also: