Class OracleResourceProviderParameterUtils
java.lang.Object
io.micronaut.security.ojdbc.extensions.OracleResourceProviderParameterUtils
Utility methods for reading parameters supplied to an
OracleResourceProvider.
OJDBC supplies provider configuration as a map keyed by
OracleResourceProvider.Parameter. These helpers centralize the conversion from
CharSequence values to strings and the validation used by providers that require
specific parameters to be present.
-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable StringoptionalParameter(@NonNull Map<oracle.jdbc.spi.OracleResourceProvider.Parameter, CharSequence> parameters, @NonNull oracle.jdbc.spi.OracleResourceProvider.Parameter parameter) Returns the configured string value for an optional provider parameter.static @NonNull StringrequiredParameter(@NonNull Map<oracle.jdbc.spi.OracleResourceProvider.Parameter, CharSequence> parameters, @NonNull oracle.jdbc.spi.OracleResourceProvider.Parameter parameter) Returns the configured string value for a required provider parameter.
-
Method Details
-
requiredParameter
public static @NonNull String requiredParameter(@NonNull Map<oracle.jdbc.spi.OracleResourceProvider.Parameter, CharSequence> parameters, @NonNull oracle.jdbc.spi.OracleResourceProvider.Parameter parameter) Returns the configured string value for a required provider parameter.A parameter is considered missing when it is absent from the map or when its string value is empty. Non-empty values are returned unchanged; this method does not trim or otherwise normalize the configured value.
- Parameters:
parameters- parameters supplied by OJDBCparameter- parameter whose configured value is required- Returns:
- the configured value converted to a string
- Throws:
IllegalStateException- if the parameter is absent or empty
-
optionalParameter
public static @Nullable String optionalParameter(@NonNull Map<oracle.jdbc.spi.OracleResourceProvider.Parameter, CharSequence> parameters, @NonNull oracle.jdbc.spi.OracleResourceProvider.Parameter parameter) Returns the configured string value for an optional provider parameter.Absent parameters return
null. Present values are converted withCharSequence.toString()and returned unchanged, including blank values. Callers decide whether a blank optional value should be accepted or ignored.- Parameters:
parameters- parameters supplied by OJDBCparameter- parameter whose configured value should be read- Returns:
- the configured value converted to a string, or
nullwhen absent
-