Package io.helidon.config.spi
Interface Source<T>
-
- Type Parameters:
T
- a type of source
- All Superinterfaces:
AutoCloseable
,Changeable<T>
- All Known Subinterfaces:
ConfigSource
,OverrideSource
- All Known Implementing Classes:
AbstractConfigSource
,AbstractOverrideSource
,AbstractParsableConfigSource
,AbstractSource
,EtcdConfigSource
,GitConfigSource
public interface Source<T> extends Changeable<T>, AutoCloseable
Source of the specified type<T>
of data.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default Flow.Publisher<Optional<T>>
changes()
Deprecated.default void
close()
Closes the @{code Source}, releasing any resources it holds.default String
description()
Short, human-readable summary referring to the underlying source.Optional<T>
load()
Loads the underlying source data, converting it into anOptional
around the parameterized typeT
.
-
-
-
Method Detail
-
description
default String description()
Short, human-readable summary referring to the underlying source.For example, a file path or a URL or any other information that helps the user recognize the underlying origin of the data this
Source
provides.Default is the implementation class simple name with any
"Source"
suffix removed.- Returns:
- description of the source
-
load
Optional<T> load() throws ConfigException
Loads the underlying source data, converting it into anOptional
around the parameterized typeT
.Implementations should return
Optional.empty()
if the underlying origin does not exist.The method can be invoked repeatedly, for example during retries.
- Returns:
Optional<T>
referring to an instance ofT
as read from the underlying origin of the data (if it exists) orOptional.empty()
otherwise- Throws:
ConfigException
- in case of errors loading from the underlying origin
-
changes
@Deprecated default Flow.Publisher<Optional<T>> changes()
Deprecated.Description copied from interface:Changeable
Returns aFlow.Publisher
to which the caller can subscribe in order to receive change notifications.Method
Flow.Subscriber.onError(Throwable)
is called in case of error listening on config source data. MethodFlow.Subscriber.onComplete()
is never called.- Specified by:
changes
in interfaceChangeable<T>
- Returns:
- a publisher of events. Never returns
null
-
close
default void close() throws Exception
Closes the @{code Source}, releasing any resources it holds.- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
- in case of errors encountered while closing the source
-
-