Package dev.galasa.framework.spi.cps
Class CpsProperties
java.lang.Object
dev.galasa.framework.spi.cps.CpsProperties
Utility methods for retrieving properties from the Configuration Property
Store. Mainly used for the Manager Property Classes pattern.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static int
getIntWithDefault
(@NotNull IConfigurationPropertyStoreService cps, @javax.validation.constraints.NotNull int defaultValue, @NotNull String prefix, @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 issuegetStringList
(@NotNull IConfigurationPropertyStoreService cps, @NotNull String prefix, @NotNull String suffix, String... infixes) Retrieve a comma separated string property or an empty list if missinggetStringListWithDefault
(@NotNull IConfigurationPropertyStoreService cps, @NotNull String defaultValues, @NotNull String prefix, @NotNull String suffix, String... infixes) Retrieve an comma separated list string or the default values if the property is missing or there is an errorprotected static String
getStringNulled
(@NotNull IConfigurationPropertyStoreService cps, @NotNull String prefix, @NotNull String suffix, String... infixes) Retrieve a String property or return null if missing or an empty string.protected static @NotNull String
getStringWithDefault
(@NotNull IConfigurationPropertyStoreService cps, @NotNull String defaultValue, @NotNull String prefix, @NotNull String suffix, String... infixes) Retrieve a string property.
-
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 StoredefaultValue
- The default int if property is missing or there is an issueprefix
- The property prefixsuffix
- The property suffixinfixes
- 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 Storeprefix
- The property prefixsuffix
- The property suffixinfixes
- 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 StoredefaultValue
- The default string if property is missing or there is an issueprefix
- The property prefixsuffix
- The property suffixinfixes
- 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 StoredefaultValues
- The default comma separated list if property is missing or there is an issueprefix
- The property prefixsuffix
- The property suffixinfixes
- 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 Storeprefix
- The property prefixsuffix
- The property suffixinfixes
- Options infixes- Returns:
- a list of properties or Empty list if missing
- Throws:
ConfigurationPropertyStoreException
-