T
- a type of source dataS
- a type of data stampChangeable<T>
, Source<T>
, java.lang.AutoCloseable
AbstractConfigSource
, AbstractOverrideSource
public abstract class AbstractSource<T,S> extends java.lang.Object implements Source<T>
The inner AbstractSource.Builder
class is ready-to-extend with built-in support of
changes (polling strategy, executor, buffer size) and mandatory/optional
attribute.
Modifier and Type | Class | Description |
---|---|---|
static class |
AbstractSource.Builder<B extends AbstractSource.Builder<B,T,S>,T,S> |
A common
AbstractSource builder, suitable for concrete Builder implementations
related to AbstractSource extensions to extend. |
static class |
AbstractSource.Data<D,S> |
Data loaded at appropriate time.
|
Modifier and Type | Method | Description |
---|---|---|
protected abstract java.util.Optional<S> |
dataStamp() |
Returns current stamp of data in config source.
|
java.lang.String |
description() |
Short, human-readable summary referring to the underlying source.
|
protected void |
fireChangeEvent() |
Fires a change event when source has changed.
|
protected boolean |
isMandatory() |
|
java.util.Optional<T> |
load() |
Loads data from source when
data expires. |
protected abstract AbstractSource.Data<T,S> |
loadData() |
Loads new data from config source.
|
protected AbstractSource.Data<T,S> |
processLoadedData(AbstractSource.Data<T,S> data) |
Performs any postprocessing of config data after loading.
|
protected java.lang.String |
uid() |
Returns universal id of source to be used to construct
description() . |
protected java.lang.String uid()
description()
.protected boolean isMandatory()
protected void fireChangeEvent()
protected AbstractSource.Data<T,S> processLoadedData(AbstractSource.Data<T,S> data)
Data
.data
- an input dataprotected abstract java.util.Optional<S> dataStamp()
public final java.util.Optional<T> load()
data
expires.protected abstract AbstractSource.Data<T,S> loadData() throws ConfigException
ConfigException
- in case it is not possible to load configuration datapublic final java.lang.String description()
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.
description
in interface Source<T>
Copyright © 2018 Oracle Corporation. All rights reserved.