Package net.kyori.option.value
Interface ValueSource
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A source for external option values.
- Since:
- 1.1.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic ValueSourceA value source that will extract option values from environment variables.static ValueSourceenvironmentVariable(String prefix) A value source that will extract option values from environment variables.static ValueSourceA value source that will extract option values from system properties.static ValueSourcesystemProperty(String prefix) A value source that will extract option values from system properties.<T> @Nullable TProvide a value for the specified option, if any is set.
-
Method Details
-
environmentVariable
A value source that will extract option values from environment variables.Any of the characters
:,/, and-will be replaced with_.- Returns:
- an environment variable-backed value source with no prefix
- Since:
- 1.1.0
-
environmentVariable
A value source that will extract option values from environment variables.Any of the characters
:,/, and-will be replaced with_.- Parameters:
prefix- the prefix for environment lookup, which will be prepended to keys followed by a_, or the empty string for no prefix- Returns:
- an environment variable-backed value source
- Since:
- 1.1.0
-
systemProperty
A value source that will extract option values from system properties.Any of the characters
:and/will be replaced with..- Returns:
- a system property-backed value source with no prefix
- Since:
- 1.1.0
-
systemProperty
A value source that will extract option values from system properties.Any of the characters
:and/will be replaced with..- Parameters:
prefix- the prefix for property lookup, which will be prepended to properties followed by a., or the empty string for no prefix- Returns:
- a system property-backed value source
- Since:
- 1.1.0
-
value
Provide a value for the specified option, if any is set.- Type Parameters:
T- the value type- Parameters:
option- the option- Returns:
- a value, if set
- Since:
- 1.1.0
-