Interface Configuration

All Known Implementing Classes:
DefaultConfiguration

public interface Configuration
Read-only configuration for source generators.
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    booleanValue(@NonNull String key, boolean defaultValue)
    Returns the boolean value for the required key.
    boolean
    Returns true if the configuration contains an entry for the specified key.
    @NonNull Runtime
    Returns the target runtime for optimizations.
    default boolean
    isFeatureEnabled(@NonNull String featureId)
    Returns true if a particular optimizer is enabled, independently of the runtime.
    @NonNull String
    Returns the value of the configuration for the requested key or fails if not available.
    default @Nullable String
    optionalString(@NonNull String key, @Nullable String defaultValue)
    Returns the string for the specified configuration key, or the default value when missing.
    <T> T
    Returns the value for the requested key.
    default @NonNull List<String>
    stringList(@NonNull String key)
    Returns a list of strings from a configuration entry.
    default @NonNull List<String>
    stringList(@NonNull String key, @NonNull String separator)
    Returns a list of strings from a configuration entry.
  • Method Details

    • containsKey

      boolean containsKey(String key)
      Returns true if the configuration contains an entry for the specified key.
      Parameters:
      key - the key to look for
      Returns:
      true if the configuration contains an entry for the key
    • mandatoryValue

      @NonNull @NonNull String mandatoryValue(String key)
      Returns the value of the configuration for the requested key or fails if not available.
      Parameters:
      key - the key to look for
      Returns:
      the value for the requested key
    • optionalValue

      @Nullable <T> T optionalValue(String key, Function<Optional<String>,T> producer)
      Returns the value for the requested key.
      Type Parameters:
      T - the type of the return value
      Parameters:
      key - the configuration key
      producer - a function called to generate a transformed value
      Returns:
      a configured value
    • optionalString

      @Nullable default @Nullable String optionalString(@NonNull @NonNull String key, @Nullable @Nullable String defaultValue)
      Returns the string for the specified configuration key, or the default value when missing.
      Parameters:
      key - the key
      defaultValue - the default value
      Returns:
      a configured string
    • stringList

      @NonNull default @NonNull List<String> stringList(@NonNull @NonNull String key)
      Returns a list of strings from a configuration entry. The value is assumed to be of type String and will be splitted using the "," and ";" separators
      Parameters:
      key - the configuration key
      Returns:
      a list of strings, or an empty list when missing
    • stringList

      @NonNull default @NonNull List<String> stringList(@NonNull @NonNull String key, @NonNull @NonNull String separator)
      Returns a list of strings from a configuration entry. The value is assumed to be of type String and will be split. using the "," and ":" separators
      Parameters:
      key - the key to look for
      separator - a separator regular expression
      Returns:
      the list of values, or an empty list
    • booleanValue

      default boolean booleanValue(@NonNull @NonNull String key, boolean defaultValue)
      Returns the boolean value for the required key. If the value isn't found, returns the default value
      Parameters:
      key - the key to look for
      defaultValue - the default value when missing
      Returns:
      the boolean value
    • isFeatureEnabled

      default boolean isFeatureEnabled(@NonNull @NonNull String featureId)
      Returns true if a particular optimizer is enabled, independently of the runtime. All features need to be explicitly enabled by configuration.
      Parameters:
      featureId - the feature id
      Returns:
      true if the feature is enabled
    • getRuntime

      @NonNull @NonNull Runtime getRuntime()
      Returns the target runtime for optimizations.
      Returns:
      the target runtime