Creates and configures a new Dotenv instance
| 11 | * Creates and configures a new Dotenv instance |
| 12 | */ |
| 13 | public interface Dotenv { |
| 14 | |
| 15 | /** |
| 16 | * A dotenv entry filter |
| 17 | */ |
| 18 | enum Filter { |
| 19 | /** |
| 20 | * Filter matching only environment variables declared in the .env file |
| 21 | */ |
| 22 | DECLARED_IN_ENV_FILE |
| 23 | } |
| 24 | |
| 25 | /** |
| 26 | * Configures a new {@link Dotenv} instance |
| 27 | * @return a new {@link Dotenv} instance |
| 28 | */ |
| 29 | static DotenvBuilder configure() { |
| 30 | return new DotenvBuilder(); |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Creates and loads a {@link Dotenv} instance with default options |
| 35 | * @return a new {@link Dotenv} instance |
| 36 | */ |
| 37 | static Dotenv load() { |
| 38 | return new DotenvBuilder().load(); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Returns the set of environment variables with values |
| 43 | * @return the set of {@link DotenvEntry}s for all environment variables |
| 44 | */ |
| 45 | Set<DotenvEntry> entries(); |
| 46 | |
| 47 | /** |
| 48 | * Returns the set of {@link DotenvEntry}s matching the filter |
| 49 | * @param filter the filter e.g. {@link Dotenv.Filter} |
| 50 | * @return the set of {@link DotenvEntry}s for environment variables matching the {@link Dotenv.Filter} |
| 51 | */ |
| 52 | Set<DotenvEntry> entries(Filter filter); |
| 53 | |
| 54 | /** |
| 55 | * Retrieves the value of the environment variable specified by key |
| 56 | * @param key the environment variable |
| 57 | * @return the value of the environment variable |
| 58 | */ |
| 59 | String get(String key); |
| 60 | |
| 61 | /** |
| 62 | * Retrieves the value of the environment variable specified by key. |
| 63 | * If the key does not exist, then the default value is returned |
| 64 | * @param key the environment variable |
| 65 | * @param defaultValue the default value to return |
| 66 | * @return the value of the environment variable or default value |
| 67 | */ |
| 68 | String get(String key, String defaultValue); |
| 69 | } |
no outgoing calls
no test coverage detected