Interface FragmentDataAccess

All Known Implementing Classes:
BackoffPolicyFragment, CommonConfigFragment, ConfigFragment

public interface FragmentDataAccess
The data access for a ConfigFragment. ConfigFragments require access to the parameter and string values from the configuration, but have different types of data avialable to extract that data from. This interface defines the methods that the ConfigFragment may use to retrieve data as well as providing implementations against both the AbstractConfig and a map of String to ConfigValue.
  • Method Summary

    Modifier and Type
    Method
    Description
    from(Map<String,org.apache.kafka.common.config.ConfigValue> configValues)
    Creates an implementation against a map of String to ConfigValues.
    from(org.apache.kafka.common.config.AbstractConfig cfg)
    Creates an implementation against an AbstractConfig.
    Get the boolean value associated with the key.
    <T> T
    getConfiguredInstance(String key, Class<? extends T> clazz)
    Creates a configured instance of the class specified by the key.
    Get the integer value associated with the key.
    Get the list of strings associated with the key.
    Get the long value associated with the key.
    org.apache.kafka.common.config.types.Password
    Get the password associated with the key.
    Gets the String value from the key.
    boolean
    has(String key)
    Determines if a key has been set.
    Gets the map of String to value.
  • Method Details

    • from

      static FragmentDataAccess from(org.apache.kafka.common.config.AbstractConfig cfg)
      Creates an implementation against an AbstractConfig.
      Parameters:
      cfg - the AbstractConfig to get values from.
      Returns:
      a FragmentDataAccess
    • from

      static FragmentDataAccess from(Map<String,org.apache.kafka.common.config.ConfigValue> configValues)
      Creates an implementation against a map of String to ConfigValues.
      Parameters:
      configValues - the map of string to ConfigValues.
      Returns:
      a FragmentDataAccess
    • values

      Map<String,?> values()
      Gets the map of String to value.
      Returns:
      the map of String to value.
    • getString

      String getString(String key)
      Gets the String value from the key.
      Parameters:
      key - the key to lookup.
      Returns:
      the String value associated with the key.
    • has

      boolean has(String key)
      Determines if a key has been set.
      Parameters:
      key - The key to check.
      Returns:
      true if the key was set, false if the key was not set or does not exist in the config.
    • getInt

      Integer getInt(String key)
      Get the integer value associated with the key.
      Parameters:
      key - the key to look up.
      Returns:
      the integer value.
    • getLong

      Long getLong(String key)
      Get the long value associated with the key.
      Parameters:
      key - the key to look up.
      Returns:
      the long value.
    • getBoolean

      Boolean getBoolean(String key)
      Get the boolean value associated with the key.
      Parameters:
      key - the key to look up.
      Returns:
      the boolean value.
    • getList

      List<String> getList(String key)
      Get the list of strings associated with the key.
      Parameters:
      key - the key to look up.
      Returns:
      the list of strings.
    • getPassword

      org.apache.kafka.common.config.types.Password getPassword(String key)
      Get the password associated with the key.
      Parameters:
      key - the key to look up.
      Returns:
      the password associated with the key.
    • getConfiguredInstance

      <T> T getConfiguredInstance(String key, Class<? extends T> clazz)
      Creates a configured instance of the class specified by the key. The value of the key may be either a class name or the instance of the class itsef.
      Type Parameters:
      T - the expected type of the return value.
      Parameters:
      key - the key to look up.
      clazz - class to return.
      Returns:
      an object of class clazz.