Class OracleResourceProviderParameterUtils

java.lang.Object
io.micronaut.security.ojdbc.extensions.OracleResourceProviderParameterUtils

@Internal public final class OracleResourceProviderParameterUtils extends Object
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 Type
    Method
    Description
    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.
    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.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 OJDBC
      parameter - 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 with CharSequence.toString() and returned unchanged, including blank values. Callers decide whether a blank optional value should be accepted or ignored.

      Parameters:
      parameters - parameters supplied by OJDBC
      parameter - parameter whose configured value should be read
      Returns:
      the configured value converted to a string, or null when absent