-
- All Superinterfaces:
Source
- All Known Implementing Classes:
ClasspathConfigSource
,EtcdConfigSource
,FileConfigSource
,GitConfigSource
,UrlConfigSource
public interface ParsableSource extends Source
An eager source that can read all data from the underlying origin as a stream that can be parsed based on its media type (or using an explicitConfigParser
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ParsableSource.Builder<B extends ParsableSource.Builder<B>>
A builder for a parsable source.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Optional<ConfigParser.Content>
load()
Loads the underlying source data.Optional<String>
mediaType()
If media type is configured on this source, or can be guessed from the underlying origin, return it.Optional<ConfigParser>
parser()
If a parser is configured with this source, return it.default Function<String,Optional<InputStream>>
relativeResolver()
Resolve relative resource to the current resource.-
Methods inherited from interface io.helidon.config.spi.Source
description, exists, optional, retryPolicy
-
-
-
-
Method Detail
-
load
Optional<ConfigParser.Content> load() throws ConfigException
Loads the underlying source data. This method is only called when the sourceSource.exists()
.The method can be invoked repeatedly, for example during retries. In case the underlying data is gone or does not exist, return an empty optional.
- Returns:
- An instance of
T
as read from the underlying origin of the data (if it exists) - Throws:
ConfigException
- in case of errors loading from the underlying origin
-
parser
Optional<ConfigParser> parser()
If a parser is configured with this source, return it. The source implementation does not need to handle config parser.- Returns:
- content parser if one is configured on this source
-
mediaType
Optional<String> mediaType()
If media type is configured on this source, or can be guessed from the underlying origin, return it. The media type may be used to locate aConfigParser
if one is not explicitly configured.- Returns:
- media type if configured or detected from content
-
relativeResolver
default Function<String,Optional<InputStream>> relativeResolver()
Resolve relative resource to the current resource.- Returns:
- a function to resolve resource name into an input stream
-
-