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, theReloadableValueSetclass can be useful. The class extendsValueSetbut relies on aSupplierto 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
Supplierdecides 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) aRuntimeExceptionmust 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 booleanequals(Object obj)LocalDategetDate()Gets the value set date/version.StringgetId()Gets the value set IDMap<String,ValueSetValue>getValues()Gets the value set values.inthashCode()voidsetDate(LocalDate date)Not allowed to call - will throwIllegalArgumentException.voidsetId(String id)Not allowed to call - will throwIllegalArgumentException.voidsetValues(Map<String,ValueSetValue> values)Not allowed to call - will throwIllegalArgumentException.StringtoString()
-
-
-
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.
-
-