Skip to content

Commit

Permalink
Added getAsCharArrayOrFallback
Browse files Browse the repository at this point in the history
phax committed Nov 4, 2024
1 parent 67a256f commit 4348ad1
Showing 2 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -128,6 +128,27 @@ public String getAsStringOrFallback (@Nonnull final String sPrimary, @Nonnull fi
return ret;
}

@Nullable
public char [] getAsCharArrayOrFallback (@Nonnull final String sPrimary, @Nonnull final String... aOldOnes)
{
char [] ret = getAsCharArray (sPrimary);
if (ret != null)
{
// Try the old names
for (final String sOld : aOldOnes)
{
ret = getAsCharArray (sOld);
if (ret != null)
{
// Notify on old name usage
m_aOutdatedNotifier.onOutdatedConfigurationKey (sOld, sPrimary);
break;
}
}
}
return ret;
}

@Nullable
public BigDecimal getAsBigDecimalOrFallback (@Nonnull final String sPrimary, @Nonnull final String... aOldOnes)
{
Original file line number Diff line number Diff line change
@@ -65,6 +65,22 @@ public interface IConfigWithFallback extends IConfig
@Nullable
String getAsStringOrFallback (@Nonnull String sPrimary, @Nonnull @Nonempty String... aOldOnes);

/**
* Get the configuration value as a char array based on the primary or the
* alternative keys.
*
* @param sPrimary
* Primary configuration key. Should not be <code>null</code>.
* @param aOldOnes
* The alternative keys to be resolved in the provided order. May
* neither be <code>null</code> nor empty.
* @return <code>null</code> if neither the primary nor the old configuration
* property keys could be resolved.
* @since 11.1.10
*/
@Nullable
char [] getAsCharArrayOrFallback (@Nonnull String sPrimary, @Nonnull @Nonempty String... aOldOnes);

/**
* Get the configuration value as a BigDecimal based on the primary or the
* alternative keys.

0 comments on commit 4348ad1

Please sign in to comment.