T - a type of source dataS - a type of data stamppublic abstract class AbstractSource<T,S> extends 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 and 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 and Description |
|---|---|
protected abstract Optional<S> |
dataStamp()
Returns current stamp of data in config source.
|
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() |
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 String |
uid()
Returns universal id of source to be used to construct
description(). |
protected 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 Optional<S> dataStamp()
protected abstract AbstractSource.Data<T,S> loadData() throws ConfigException
ConfigException - in case it is not possible to load configuration datapublic final 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 and/or its affiliates. All Rights Reserved. Use is subject to license terms.