Class ProfileDB
java.lang.Object
org.apache.wayang.commons.util.profiledb.ProfileDB
This class provides facilities to save and load
Experiments.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappend(Collection<Experiment> experiments) Related to file based storage, Receive a Collection ofExperiments and persist them at the end of a filevoidappend(Experiment... experiments) Related to file based storage, Receive an array ofExperiments and persist them at the end of a filecom.google.gson.GsongetGson()Provide aGsonobject.To work with storage object provided to persist or load experimentsload()BringExperiments from current Storage to local variableload(InputStream inputStream) BringExperiments from current Storage to local variableregisterMeasurementClass(Class<? extends Measurement> measurementClass) Register aMeasurementtype.voidsave(Collection<Experiment> experiments) Receive a Collection ofExperiments and persist themvoidsave(Collection<Experiment> experiments, OutputStream outputStream) Receive a Collection ofExperiments and persist themvoidsave(Experiment... experiments) Receive an array ofExperiments and persist themwithGsonPreparation(Consumer<com.google.gson.GsonBuilder> preparation) Apply any changes necessary toGsonso that it can be used for de/serialization of custom objects.
-
Constructor Details
-
ProfileDB
Creates a new instance.
-
-
Method Details
-
save
Receive an array ofExperiments and persist them- Parameters:
experiments- Array ofExperiments to be persisted- Throws:
IOException
-
save
Receive a Collection ofExperiments and persist them- Parameters:
experiments- Collection ofExperiments to be persisted- Throws:
IOException
-
save
Receive a Collection ofExperiments and persist them- Parameters:
experiments- Collection ofExperiments to be persistedoutputStream- Indicates where the data must to be written- Throws:
IOException
-
append
Related to file based storage, Receive an array ofExperiments and persist them at the end of a file- Parameters:
experiments- Array ofExperiments to be persisted- Throws:
IOException
-
append
Related to file based storage, Receive a Collection ofExperiments and persist them at the end of a file- Parameters:
experiments- Collection ofExperiments to be persisted- Throws:
IOException
-
load
BringExperiments from current Storage to local variable- Returns:
- Collection of
Experiments - Throws:
IOException
-
load
BringExperiments from current Storage to local variable- Parameters:
inputStream- Data to be read- Returns:
- Collection of
Experiments - Throws:
IOException
-
getStorage
To work with storage object provided to persist or load experiments- Returns:
- Storage object proportioned for this instance
-
registerMeasurementClass
Register aMeasurementtype. This is required before being able to load that type.- Parameters:
measurementClass- theMeasurementClass- Returns:
- this instance
-
withGsonPreparation
Apply any changes necessary toGsonso that it can be used for de/serialization of custom objects.- Parameters:
preparation- a preparatory step performed on aGsonBuilder- Returns:
- this instance
-
getGson
public com.google.gson.Gson getGson()Provide aGsonobject.- Returns:
- the
Gsonobject
-