Package se.digg.dgc.valueset.v1
Class ReloadableValueSet
- java.lang.Object
-
- se.digg.dgc.valueset.v1.ValueSet
-
- se.digg.dgc.valueset.v1.ReloadableValueSet
-
public class ReloadableValueSet extends ValueSet
Since value sets may change over time and we really don't want to have to re-compile our programs everytime a value set changes, theReloadableValueSet
class can be useful. The class extendsValueSet
but relies on aSupplier
to get the value set data.This supplier typically reads the value set from a JSON configuration file holding the data, or from a resource accessed over HTTP(S).
The implementation of the
Supplier
decides how often the value set data is reloaded, and the implementation is responsible of caching the current set of data.Note:The
Supplier.get()
method MUST NEVER returnnull
. If a download fails it should return data from its cache, and if the cache is empty (download has never succeeded) aRuntimeException
must be thrown.- 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 ReloadableValueSet(Supplier<ValueSet> supplier)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
LocalDate
getDate()
Gets the value set date/version.String
getId()
Gets the value set IDMap<String,ValueSetValue>
getValues()
Gets the value set values.int
hashCode()
void
setDate(LocalDate date)
Not allowed to call - will throwIllegalArgumentException
.void
setId(String id)
Not allowed to call - will throwIllegalArgumentException
.void
setValues(Map<String,ValueSetValue> values)
Not allowed to call - will throwIllegalArgumentException
.String
toString()
-
-
-
Method Detail
-
getId
public String getId()
Gets the value set ID
-
setId
public void setId(String id)
Not allowed to call - will throwIllegalArgumentException
.
-
getDate
public LocalDate getDate()
Gets the value set date/version.
-
setDate
public void setDate(LocalDate date)
Not allowed to call - will throwIllegalArgumentException
.
-
getValues
public Map<String,ValueSetValue> getValues()
Gets the value set values.
-
setValues
public void setValues(Map<String,ValueSetValue> values)
Not allowed to call - will throwIllegalArgumentException
.
-
-