- All Known Implementing Classes:
HoconConfigParser
,PropertiesConfigParser
,YamlConfigParser
ConfigParser.Content
into a ConfigNode.ObjectNode
that
represents the original structure and values from the content.
The application can register parsers on a Builder
using the
Config.Builder.addParser(ConfigParser)
method. The
config system also locates parsers using the Java
ServiceLoader
mechanism and automatically adds them to
every Builder
unless the application disables this feature for a
given Builder
by invoking
Config.Builder.disableParserServices()
.
A parser can specify a Weight
. If no weight is
explicitly assigned, the value of 100.0 is assumed.
Parser is used by the config system and a config source provides data as an input stream.
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Config content to be parsed by aConfigParser
. -
Method Summary
Modifier and TypeMethodDescriptionparse
(ConfigParser.Content content) Deprecated.default ConfigNode.ObjectNode
parse
(ConfigParser.Content content, Function<String, Optional<InputStream>> relativeResolver) Parses a specifiedConfigContent
into ahierarchical configuration representation
.Returns set of supported media types by the parser.Config parser can define supported file suffixes.
-
Method Details
-
supportedMediaTypes
Returns set of supported media types by the parser.Set of supported media types is used when config system looks for appropriate parser based on media type of content.
ParsableSource
implementations can useMediaTypes
to probe for media type of content to provide it to config system throughConfigParser.Content.Builder.mediaType(io.helidon.common.media.type.MediaType)
.- Returns:
- supported media types by the parser
-
parse
Deprecated.Parses a specifiedConfigContent
into ahierarchical configuration representation
.Never returns
null
.- Parameters:
content
- a content to be parsed- Returns:
- parsed hierarchical configuration representation
- Throws:
ConfigParserException
- in case of problem to parse configuration from the source
-
parse
default ConfigNode.ObjectNode parse(ConfigParser.Content content, Function<String, Optional<InputStream>> relativeResolver) Parses a specifiedConfigContent
into ahierarchical configuration representation
.Never returns
null
.- Parameters:
content
- a content to be parsedrelativeResolver
- function to resolve relative resources to this resource (if supported by the source)- Returns:
- parsed hierarchical configuration representation
- Throws:
ConfigParserException
- in case of problem to parse configuration from the source
-
supportedSuffixes
Config parser can define supported file suffixes. If such are defined, Helidon will use these to discover default configuration sources. For example if there is aConfigParser
that returnsxml
, config would look formeta-config.xml
to discover meta configuration, and forapplication.xml
on file system and on classpath to discover configuration files.Note that the suffixes must resolve into a media type supported by a config parser (see
MediaTypes.detectExtensionType(String)
).- Returns:
- a set of file suffixes supported by this config parser.
-
parse(io.helidon.config.spi.ConfigParser.Content, java.util.function.Function)
instead