Package se.digg.dgc.valueset.v1
Class AbstractValueSetSupplier<T>
- java.lang.Object
-
- se.digg.dgc.valueset.v1.AbstractValueSetSupplier<T>
-
- Type Parameters:
T
- the type of resource being handled
- Direct Known Subclasses:
FilebasedValueSetSupplier
public abstract class AbstractValueSetSupplier<T> extends Object implements Supplier<ValueSet>
- Author:
- Martin Lindström (martin@idsec.se), Henrik Bengtsson (extern.henrik.bengtsson@digg.se), Henric Norlander (extern.henric.norlander@digg.se)
-
-
Constructor Summary
Constructors Constructor Description AbstractValueSetSupplier(T resource, Duration refreshRate)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ValueSet
get()
protected abstract String
getResourceString(T resource)
Returns a string representation of the resource being handled.protected abstract ValueSet
getValueSet(T resource)
Reads the value set from the resource.
-
-
-
Constructor Detail
-
AbstractValueSetSupplier
public AbstractValueSetSupplier(T resource, Duration refreshRate) throws IOException
Constructor.- Parameters:
resource
- the resource holding the value setrefreshRate
- the refresh rate (how often should the file be re-read?)- Throws:
IOException
- if the file can not be read or if the JSON can not be successfully parsed
-
-
Method Detail
-
getValueSet
protected abstract ValueSet getValueSet(T resource) throws IOException
Reads the value set from the resource.- Returns:
- the value set
- Throws:
IOException
- for read errors
-
-