Interface ConfNGKey


  • public interface ConfNGKey
    Interface for configuration keys used by ConfNG.

    This interface defines the contract for configuration keys that can be used with the ConfNG configuration management system. Implementations should provide a unique key identifier, default value, and sensitivity marking for proper handling in logs and output.

    Typically implemented by enums to provide type-safe configuration keys with compile-time checking.

    Example usage:

    
     public enum MyConfig implements ConfNGKey {
         DATABASE_URL("db.url", "localhost:5432", false),
         API_KEY("api.key", null, true);
         
         // Implementation details...
     }
     
    Since:
    1.0
    Author:
    Bharat Kumar Malviya, GitHub: github.com/imBharatMalviya
    See Also:
    ConfNG
    • Method Detail

      • getKey

        String getKey()
        Returns the configuration key identifier.

        This key will be used to look up configuration values from various sources such as environment variables, system properties, properties files, and JSON configuration files.

        Returns:
        the configuration key identifier, never null
      • getDefaultValue

        String getDefaultValue()
        Returns the default value for this configuration key.

        This value will be returned when no configuration source provides a value for this key. Can be null if no default is appropriate.

        Returns:
        the default value, may be null
      • isSensitive

        boolean isSensitive()
        Indicates whether this configuration key contains sensitive information.

        Sensitive configurations (like passwords, API keys, tokens) should be masked in logs and debug output to prevent accidental exposure of sensitive information.

        Returns:
        true if this configuration contains sensitive data, false otherwise