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 {@link
009 * 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 * @deprecated use ConfigPropertyPlugin Instead
015 */
016@NullMarked
017@Deprecated(forRemoval = true)
018public interface PropertyRequiresPlugin extends InjectExtension {
019
020  /**
021   * Return a configuration value that might not exist.
022   */
023  Optional<String> get(String property);
024
025  /**
026   * Return true if the property is defined.
027   */
028  boolean contains(String property);
029
030  /** Return true if the property is not defined. */
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  boolean equalTo(String property, String value);
037
038  /** Return true if the property is not defined or not equal to the given value. */
039  default boolean notEqualTo(String property, String value) {
040    return !equalTo(property, value);
041  }
042
043}