001package io.avaje.inject.spi;
002
003import java.util.Optional;
004
005import org.jspecify.annotations.NullMarked;
006
007/**
008 * Plugin interface which contains the application properties used for wiring. Used with
009 * {@link io.avaje.inject.RequiresProperty} and {@link io.avaje.inject.Profile}.
010 *
011 * <p>The plugin is loaded via ServiceLoader and defaults to an implementation that uses {@link
012 * System#getProperty(String)} and {@link System#getenv(String)}.
013 */
014@NullMarked
015public interface ConfigPropertyPlugin extends InjectExtension, PropertyRequiresPlugin {
016
017  /**
018   * Return a configuration value that might not exist.
019   */
020  @Override
021  Optional<String> get(String property);
022
023  /**
024   * Return true if the property is defined.
025   */
026  @Override
027  boolean contains(String property);
028
029  /** Return true if the property is not defined. */
030  @Override
031  default boolean missing(String property) {
032    return !contains(property);
033  }
034
035  /** Return true if the property is equal to the given value. */
036  @Override
037  boolean equalTo(String property, String value);
038
039  /** Return true if the property is not defined or not equal to the given value. */
040  @Override
041  default boolean notEqualTo(String property, String value) {
042    return !equalTo(property, value);
043  }
044}