Configs

public class Configs

Represents all configs as well as the default config, sms-config.json

Constructors

Configs

public Configs()

Creates a new instance, used by Jackson.

Methods

getConfig

public Config getConfig(String name)

Fetches the config with the given name.

Parameters:
  • name – the name of the config
Throws:
Returns:

the config with the given name, never null

getConfigOrDefault

public Config getConfigOrDefault(String name)

Returns the config with the given name, or the default config if the provided name is null or empty.

Parameters:
  • name – the name of the desired configuration, or null/empty string for the default configuration
Throws:
Returns:

the matching configuration

getConfigs

public List<Config> getConfigs()
Returns:all available configurations

getDefaultConfig

public Config getDefaultConfig()

Returns the default configuration, users can make one of the configurations default.

Throws:
Returns:

the default configuration, never null

getDefaultConfigName

public String getDefaultConfigName()

Returns the name of the default configuration.

Returns:the name of the default configuration or null if it was not set

hasConfig

public boolean hasConfig(String name)

Checks whether a configuration with the given name exists.

Parameters:
  • name – the name of the configuration
Returns:

true if it exists, false otherwise

isEmpty

public boolean isEmpty()

Checks whether there are no configurations available.

Returns:true if there are no configurations, false otherwise

setConfigs

public void setConfigs(List<Config> configs)
Parameters:
  • configs – all available configurations

setDefaultConfigName

public void setDefaultConfigName(String name)

Sets the name of the default configuration.

Parameters:
  • name – the name of the default configuration