Class CpsProperties

java.lang.Object
dev.galasa.framework.spi.cps.CpsProperties

public class CpsProperties extends Object
Utility methods for retrieving properties from the Configuration Property Store. Mainly used for the Manager Property Classes pattern.
  • Constructor Details

    • CpsProperties

      public CpsProperties()
  • Method Details

    • getIntWithDefault

      protected static int getIntWithDefault(@NotNull @NotNull IConfigurationPropertyStoreService cps, @NotNull @javax.validation.constraints.NotNull int defaultValue, @NotNull @NotNull String prefix, @NotNull @NotNull String suffix, String... infixes)
      Retrieve an int from the CPS or return a default if it the property is missing or there is an issue
      Parameters:
      cps - The Configuration Property Store
      defaultValue - The default int if property is missing or there is an issue
      prefix - The property prefix
      suffix - The property suffix
      infixes - Options infixes
      Returns:
      the found int or default
    • getStringNulled

      protected static String getStringNulled(@NotNull @NotNull IConfigurationPropertyStoreService cps, @NotNull @NotNull String prefix, @NotNull @NotNull String suffix, String... infixes) throws ConfigurationPropertyStoreException
      Retrieve a String property or return null if missing or an empty string. No default value is provided
      Parameters:
      cps - The Configuration Property Store
      prefix - The property prefix
      suffix - The property suffix
      infixes - Options infixes
      Returns:
      the property value trimmed or null if missing
      Throws:
      ConfigurationPropertyStoreException
    • getStringWithDefault

      @NotNull protected static @NotNull String getStringWithDefault(@NotNull @NotNull IConfigurationPropertyStoreService cps, @NotNull @NotNull String defaultValue, @NotNull @NotNull String prefix, @NotNull @NotNull String suffix, String... infixes)
      Retrieve a string property. If the property is missing or there is an error, the default value is returned.
      Parameters:
      cps - The Configuration Property Store
      defaultValue - The default string if property is missing or there is an issue
      prefix - The property prefix
      suffix - The property suffix
      infixes - Options infixes
      Returns:
      the trimmed property value or default is missing or there is an error
    • getStringListWithDefault

      @NotNull protected static @NotNull List<String> getStringListWithDefault(@NotNull @NotNull IConfigurationPropertyStoreService cps, @NotNull @NotNull String defaultValues, @NotNull @NotNull String prefix, @NotNull @NotNull String suffix, String... infixes)
      Retrieve an comma separated list string or the default values if the property is missing or there is an error
      Parameters:
      cps - The Configuration Property Store
      defaultValues - The default comma separated list if property is missing or there is an issue
      prefix - The property prefix
      suffix - The property suffix
      infixes - Options infixes
      Returns:
      a list of properties or the defaults if missing or an error
    • getStringList

      @NotNull protected static @NotNull List<String> getStringList(@NotNull @NotNull IConfigurationPropertyStoreService cps, @NotNull @NotNull String prefix, @NotNull @NotNull String suffix, String... infixes) throws ConfigurationPropertyStoreException
      Retrieve a comma separated string property or an empty list if missing
      Parameters:
      cps - The Configuration Property Store
      prefix - The property prefix
      suffix - The property suffix
      infixes - Options infixes
      Returns:
      a list of properties or Empty list if missing
      Throws:
      ConfigurationPropertyStoreException