@Alternative @ApplicationScoped public class YamlSettingsBuilder extends Object implements SettingsBuilder
SettingsBuilder
implementation that behaves like a DefaultSettingsBuilder
implementation but without needlessly
requiring round-trip serialization and deserialization of the
underlying settings, and that reads YAML files instead of XML
files.build(SettingsBuildingRequest)
,
DefaultSettingsBuilder
Constructor and Description |
---|
YamlSettingsBuilder()
|
YamlSettingsBuilder(SettingsValidator settingsValidator,
MavenSettingsMerger merger)
Creates a new
YamlSettingsBuilder . |
Modifier and Type | Method and Description |
---|---|
SettingsBuildingResult |
build(SettingsBuildingRequest request)
Deserializes a
Settings from a stream-based source
represented by the supplied SettingsBuildingRequest and
returns it wrapped by a SettingsBuildingResult in much
the same manner as the DefaultSettingsBuilder.build(SettingsBuildingRequest) method,
but using YAML instead of XML, and performing interpolation in a
more efficient manner. |
Settings |
read(Source source,
boolean strict,
org.codehaus.plexus.interpolation.Interpolator interpolator,
SettingsProblemCollector problemCollector)
|
public YamlSettingsBuilder()
@Inject public YamlSettingsBuilder(SettingsValidator settingsValidator, MavenSettingsMerger merger)
YamlSettingsBuilder
.settingsValidator
- a SettingsValidator
implementation that will validate the Settings
object
once it has been successfully deserialized; if null
then
a DefaultSettingsValidator
implementation will be used
insteadmerger
- a MavenSettingsMerger
that will be used to
merge global and user-specific Settings
objects; if
null
, then a new MavenSettingsMerger
will be used
insteadpublic SettingsBuildingResult build(SettingsBuildingRequest request) throws SettingsBuildingException
Settings
from a stream-based source
represented by the supplied SettingsBuildingRequest
and
returns it wrapped by a SettingsBuildingResult
in much
the same manner as the DefaultSettingsBuilder.build(SettingsBuildingRequest)
method,
but using YAML instead of XML, and performing interpolation in a
more efficient manner.
This method never returns null
.
Overrides of this method must not return null
.
build
in interface SettingsBuilder
request
- the SettingsBuildingRequest
representing
the settings location; must not be null
null
SettingsBuildingResult
NullPointerException
- if request
is null
SettingsBuildingException
- if an error occurred, but
also see the return value of the SettingsBuildingResult.getProblems()
methodread(Source, boolean, Interpolator,
SettingsProblemCollector)
public Settings read(Source source, boolean strict, org.codehaus.plexus.interpolation.Interpolator interpolator, SettingsProblemCollector problemCollector) throws IOException, SettingsParseException
Source
, reads settings information from it and
creates a new Settings
object and returns it.
This method may return null
.
Overrides of this method are permitted to return null
.
source
- the Source
representing the location of the
settings; may be null
in which case null
will be
returnedstrict
- whether or not strictness should be in effectinterpolator
- an Interpolator
for interpolating
values within the settings information; may be null
problemCollector
- a SettingsProblemCollector
to
accumulate error information; must not be null
Settings
, or null
NullPointerException
- if problemCollector
is
null
IOException
- if an input or output error occurredSettingsParseException
- if the settings information
could not be parsed as a YAML 1.1 documentCopyright © 2019–2019, microBean™. All rights reserved.