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 java.util.stream.Stream<ratpack.func.Pair<java.lang.String,java.lang.String>>
filter(ratpack.func.Pair<java.lang.String,java.lang.String> entry)
Provides an opportunity to remove environment variables from parsing by the remainder of the pipeline.java.lang.String
map(java.lang.String segment)
Transforms a segment.java.util.List<java.lang.String>
tokenize(java.lang.String name)
Splits the name of an environment variable into per-object segments.
-
-
-
Method Detail
-
filter
java.util.stream.Stream<ratpack.func.Pair<java.lang.String,java.lang.String>> filter(ratpack.func.Pair<java.lang.String,java.lang.String> entry) throws java.lang.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:
java.lang.Exception
- any- See Also:
Pair.mapLeft(ratpack.func.Function)
-
tokenize
java.util.List<java.lang.String> tokenize(java.lang.String name) throws java.lang.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:
java.lang.Exception
- any
-
map
java.lang.String map(java.lang.String segment) throws java.lang.Exception
Transforms a segment. Most commonly, this is used to convert between case formats.- Parameters:
segment
- a segment of the object path- Returns:
- the transformed segment
- Throws:
java.lang.Exception
- any- See Also:
CaseFormat
-
-