Package ratpack.config
Interface EnvironmentParser
-
public interface EnvironmentParser
Strategy for parsing a set of environment variables into a form appropriate for use in aConfigSource
. The methods are called in order:
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Stream<Pair<String,String>>
filter(Pair<String,String> entry)
Provides an opportunity to remove environment variables from parsing by the remainder of the pipeline.String
map(String segment)
Transforms a segment.List<String>
tokenize(String name)
Splits the name of an environment variable into per-object segments.
-
-
-
Method Detail
-
filter
Stream<Pair<String,String>> filter(Pair<String,String> entry) throws Exception
Provides an opportunity to remove environment variables from parsing by the remainder of the pipeline. The pair can be modified if desired as well, such as to remove prefixes.- Parameters:
entry
- an environment variable, encoded with the name on the left and the value on the right- Returns:
- a stream containing the desired entries (if any) for this entry
- Throws:
Exception
- any- See Also:
Pair.mapLeft(Function)
-
tokenize
List<String> tokenize(String name) throws Exception
Splits the name of an environment variable into per-object segments. For example, if you want nameSERVER__URL
to mean an object "SERVER" and a field "URL", you would return a two element list["SERVER", "URL"]
.- Parameters:
name
- the name of the environment variable- Returns:
- the per-object segments for the environment variable, starting with the segments closest to the root
- Throws:
Exception
- any
-
-