- java.lang.Object
-
- io.helidon.config.yaml.YamlConfigParser
-
- All Implemented Interfaces:
ConfigParser
@Priority(200) public class YamlConfigParser extends Object implements ConfigParser
YAMLConfigParser
implementation that supports "application/x-yaml".The parser implementation supports
ServiceLoader
, i.e.Config.Builder
can automatically load and registerYamlConfigParser
instance, if notdisabled
. And of course it can beregistered programmatically
.Priority of the
YamlConfigParser
to be used byConfig.Builder
, if loaded automatically as aservice
, is 200.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.helidon.config.spi.ConfigParser
ConfigParser.Content
-
-
Field Summary
Fields Modifier and Type Field Description static String
MEDIA_TYPE_APPLICATION_YAML
A String constant representing "application/x-yaml" media type.static int
PRIORITY
Priority of the parser used if registered byConfig.Builder
automatically.
-
Constructor Summary
Constructors Constructor Description YamlConfigParser()
Deprecated.This method should not be directly used, usecreate()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static YamlConfigParser
create()
Create a new YAML Config Parser.ConfigNode.ObjectNode
parse(ConfigParser.Content content)
Parses a specifiedConfigContent
into ahierarchical configuration representation
.Set<String>
supportedMediaTypes()
Returns set of supported media types by the parser.List<String>
supportedSuffixes()
Config parser can define supported file suffixes.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.helidon.config.spi.ConfigParser
parse
-
-
-
-
Field Detail
-
MEDIA_TYPE_APPLICATION_YAML
public static final String MEDIA_TYPE_APPLICATION_YAML
A String constant representing "application/x-yaml" media type.- See Also:
- Constant Field Values
-
PRIORITY
public static final int PRIORITY
Priority of the parser used if registered byConfig.Builder
automatically.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
YamlConfigParser
@Deprecated public YamlConfigParser()
Deprecated.This method should not be directly used, usecreate()
Default constructor needed by Java Service loader.
-
-
Method Detail
-
create
public static YamlConfigParser create()
Create a new YAML Config Parser.- Returns:
- a new instance of parser for YAML
-
supportedMediaTypes
public Set<String> supportedMediaTypes()
Description copied from interface:ConfigParser
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(String)
.- Specified by:
supportedMediaTypes
in interfaceConfigParser
- Returns:
- supported media types by the parser
-
supportedSuffixes
public List<String> supportedSuffixes()
Description copied from interface:ConfigParser
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)
).- Specified by:
supportedSuffixes
in interfaceConfigParser
- Returns:
- a set of file suffixes supported by this config parser.
-
parse
public ConfigNode.ObjectNode parse(ConfigParser.Content content) throws ConfigParserException
Description copied from interface:ConfigParser
Parses a specifiedConfigContent
into ahierarchical configuration representation
.Never returns
null
.- Specified by:
parse
in interfaceConfigParser
- Parameters:
content
- a content to be parsed- Returns:
- parsed hierarchical configuration representation
- Throws:
ConfigParserException
- in case of problem to parse configuration from the source
-
-