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 TypeMethodDescriptionstatic FragmentDataAccessCreates an implementation against a map of String to ConfigValues.static FragmentDataAccessfrom(org.apache.kafka.common.config.AbstractConfig cfg) Creates an implementation against an AbstractConfig.getBoolean(String key) Get the boolean value associated with the key.<T> TgetConfiguredInstance(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.PasswordgetPassword(String key) Get the password associated with the key.Gets the String value from the key.booleanDetermines if a key has been set.values()Gets the map of String to value.
-
Method Details
-
from
Creates an implementation against an AbstractConfig.- Parameters:
cfg- the AbstractConfig to get values from.- Returns:
- a FragmentDataAccess
-
from
Creates an implementation against a map of String to ConfigValues.- Parameters:
configValues- the map of string to ConfigValues.- Returns:
- a FragmentDataAccess
-
values
Gets the map of String to value.- Returns:
- the map of String to value.
-
getString
Gets the String value from the key.- Parameters:
key- the key to lookup.- Returns:
- the String value associated with the key.
-
has
Determines if a key has been set.- Parameters:
key- The key to check.- Returns:
trueif the key was set,falseif the key was not set or does not exist in the config.
-
getInt
Get the integer value associated with the key.- Parameters:
key- the key to look up.- Returns:
- the integer value.
-
getLong
Get the long value associated with the key.- Parameters:
key- the key to look up.- Returns:
- the long value.
-
getBoolean
Get the boolean value associated with the key.- Parameters:
key- the key to look up.- Returns:
- the boolean value.
-
getList
Get the list of strings associated with the key.- Parameters:
key- the key to look up.- Returns:
- the list of strings.
-
getPassword
Get the password associated with the key.- Parameters:
key- the key to look up.- Returns:
- the password associated with the key.
-
getConfiguredInstance
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.
-