Package com.helger.config.fallback
Interface IConfigWithFallback
- All Known Implementing Classes:
ConfigWithFallback
This is an extended configuration interface that supports the resolution of
configuration values from more then one key (e.g. for migration purposes).
- Since:
- 10.2.0
- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptiongetAsBigDecimalOrFallback(String sPrimary, String... aOldOnes) Get the configuration value as a BigDecimal based on the primary or the alternative keys.char[]getAsCharArrayOrFallback(String sPrimary, String... aOldOnes) Get the configuration value as a char array based on the primary or the alternative keys.intgetAsIntOrFallback(String sPrimary, int nBogus, int nDefault, String... aOldOnes) Get the configuration value as a int based on the primary or the alternative keys.longgetAsLongOrFallback(String sPrimary, long nBogus, long nDefault, String... aOldOnes) Get the configuration value as a long based on the primary or the alternative keys.getAsStringOrFallback(String sPrimary, String... aOldOnes) Get the configuration value as a String based on the primary or the alternative keys.getConfiguredValueOrFallback(String sPrimary, String... aOldOnes) Get theConfiguredValuebased on the primary or the alternative keys.Methods inherited from interface com.helger.config.IConfig
forEachConfigurationValueProvider, getConfiguredValue, getResourceBasedConfigurationValueProviderCount, reloadAllResourceBasedConfigurationValuesMethods inherited from interface com.helger.typeconvert.trait.IGetterByKeyTrait
containsNonNullValue, containsNullValue, getAsBigDecimal, getAsBigDecimal, getAsBigInteger, getAsBigInteger, getAsBoolean, getAsBoolean, getAsBooleanObj, getAsByte, getAsByte, getAsByteArray, getAsByteObj, getAsChar, getAsChar, getAsCharArray, getAsCharArray, getAsCharObj, getAsDouble, getAsDouble, getAsDoubleObj, getAsFloat, getAsFloat, getAsFloatObj, getAsInt, getAsInt, getAsIntObj, getAsLocalDate, getAsLocalDate, getAsLocalDateTime, getAsLocalDateTime, getAsLocalTime, getAsLocalTime, getAsLong, getAsLong, getAsLongObj, getAsShort, getAsShort, getAsShortObj, getAsSqlBlob, getAsSqlClob, getAsSqlDate, getAsSqlNClob, getAsSqlRowId, getAsSqlTime, getAsSqlTimestamp, getAsString, getAsString, getAsStringList, getAsStringList, getAsStringSet, getAsStringSet, getCastedValue, getCastedValue, getCastedValue, getCastedValue, getConvertedValue, getConvertedValue, getSafeCastedValue, getSafeCastedValue, getValue, getValueClass, hasStringValue, hasStringValue, onSafeCastError
-
Method Details
-
getConfiguredValueOrFallback
@Nullable ConfiguredValue getConfiguredValueOrFallback(@Nonnull String sPrimary, @Nonnull @Nonempty String... aOldOnes) Get theConfiguredValuebased on the primary or the alternative keys.- Parameters:
sPrimary- Primary configuration key. Should not benull.aOldOnes- The alternative keys to be resolved in the provided order. May neither benullnor empty.- Returns:
nullif neither the primary nor the old configuration property keys could be resolved.- See Also:
-
getAsStringOrFallback
@Nullable String getAsStringOrFallback(@Nonnull String sPrimary, @Nonnull @Nonempty String... aOldOnes) Get the configuration value as a String based on the primary or the alternative keys.- Parameters:
sPrimary- Primary configuration key. Should not benull.aOldOnes- The alternative keys to be resolved in the provided order. May neither benullnor empty.- Returns:
nullif neither the primary nor the old configuration property keys could be resolved.
-
getAsCharArrayOrFallback
@Nullable char[] getAsCharArrayOrFallback(@Nonnull String sPrimary, @Nonnull @Nonempty String... aOldOnes) Get the configuration value as a char array based on the primary or the alternative keys.- Parameters:
sPrimary- Primary configuration key. Should not benull.aOldOnes- The alternative keys to be resolved in the provided order. May neither benullnor empty.- Returns:
nullif neither the primary nor the old configuration property keys could be resolved.- Since:
- 11.1.10
-
getAsBigDecimalOrFallback
@Nullable BigDecimal getAsBigDecimalOrFallback(@Nonnull String sPrimary, @Nonnull @Nonempty String... aOldOnes) Get the configuration value as a BigDecimal based on the primary or the alternative keys.- Parameters:
sPrimary- Primary configuration key. Should not benull.aOldOnes- The alternative keys to be resolved in the provided order. May neither benullnor empty.- Returns:
nullif neither the primary nor the old configuration property keys could be resolved.
-
getAsIntOrFallback
int getAsIntOrFallback(@Nonnull String sPrimary, int nBogus, int nDefault, @Nonnull @Nonempty String... aOldOnes) Get the configuration value as a int based on the primary or the alternative keys.- Parameters:
sPrimary- Primary configuration key. Should not benull.nBogus- A value that is considered invalid for all (primary and old ones) to indicate that the other values need to be searched as well.nDefault- The value to be returned if none of the keys could be resolved.aOldOnes- The alternative keys to be resolved in the provided order. May neither benullnor empty.- Returns:
nullif neither the primary nor the old configuration property keys could be resolved.
-
getAsLongOrFallback
long getAsLongOrFallback(@Nonnull String sPrimary, long nBogus, long nDefault, @Nonnull @Nonempty String... aOldOnes) Get the configuration value as a long based on the primary or the alternative keys.- Parameters:
sPrimary- Primary configuration key. Should not benull.nBogus- A value that is considered invalid for all (primary and old ones) to indicate that the other values need to be searched as well.nDefault- The value to be returned if none of the keys could be resolved.aOldOnes- The alternative keys to be resolved in the provided order. May neither benullnor empty.- Returns:
nullif neither the primary nor the old configuration property keys could be resolved.
-