public abstract class ExperimentSpaceDeserializer extends Object
ExperimentSpace.Serialized
instance to an ExperimentSpace
and performs any other
validation and verification checks that are necessary to ensure that the ExperimentSpace
is ready
to be used to serve requests.
Different binaries may want to handle data deserialization in different ways; the Gertrude framework attempts to make as few assumptions as possible about dependencies, up to and including serialization frameworks (such as protocol buffers, Apache Avro, etc.) Other modules in the Gertrude framework provide concrete implementations of particular serialization formats and associated deserialization code for use by clients.
Constructor and Description |
---|
ExperimentSpaceDeserializer() |
Modifier and Type | Method and Description |
---|---|
protected abstract com.google.common.base.Optional<ExperimentSpace> |
deserialize(ExperimentSpace.Serialized data)
Attempts to convert the
ExperimentSpace.Serialized data to an ExperimentSpace , returning
Optional.absent() in the case that the deserialization could not be
performed. |
protected ConditionFactory |
getConditionFactory() |
protected Map<String,ExperimentFlag<?>> |
getExperimentFlags() |
void |
initialize(Map<String,ExperimentFlag<?>> experimentFlags,
ConditionFactory conditionFactory)
Initialize this instance with the compiled experiment flags and
ConditionFactory needed to
validate and parse the serialized ExperimentSpace . |
public void initialize(Map<String,ExperimentFlag<?>> experimentFlags, ConditionFactory conditionFactory)
ConditionFactory
needed to
validate and parse the serialized ExperimentSpace
.
This is only public for testing new serialization frameworks; clients should not use this method directly.
experimentFlags
- the experiment flags that have been registered with this binaryconditionFactory
- the ConditionFactory
configured for this binaryprotected Map<String,ExperimentFlag<?>> getExperimentFlags()
protected ConditionFactory getConditionFactory()
protected abstract com.google.common.base.Optional<ExperimentSpace> deserialize(ExperimentSpace.Serialized data) throws IOException
ExperimentSpace.Serialized
data to an ExperimentSpace
, returning
Optional.absent()
in the case that the deserialization could not be
performed.data
- the serialized form of an ExperimentSpace
ExperimentSpace
or an Optional.absent()
instanceIOException
- if there is an issue reading the serialized dataCopyright © 2013. All rights reserved.