diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2013-10-20 23:14:51 -0700 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net> | 2013-10-20 23:14:51 -0700 |
commit | e472550fe154f0afa5b36d2a7e2334d4680d7884 (patch) | |
tree | 8131e3fa7db162f9a072ef4d89e7fb25d338cdd4 /src/com/p4square/grow/provider/Provider.java | |
parent | 31303114ef03b13ab320ee553f11a73346be7f4a (diff) |
First stage of a major refactoring.
Question and Answer can now be serialized and deserialized to/from JSON.
As such, I no longer have to pass awkward maps around. As part of this
change I have introduced a Provider interface to abstract out loading
and persisting these beans.
The scoring logic has been completed factored out of
SurveyResultsResource and into the various ScoringEngines. Tests have
been added for Question, Answer, and the ScoringEngines. A bug has been
fixed in computing the value for slider questions.
The label identifiers in the circle questions have changed from all
lower case to camel case. That is, topleft is now topLeft. Several
issues have been corrected in the circle answers where the point values
did not match the labels.
Testing and code coverage support and reports have been added.
Diffstat (limited to 'src/com/p4square/grow/provider/Provider.java')
-rw-r--r-- | src/com/p4square/grow/provider/Provider.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/com/p4square/grow/provider/Provider.java b/src/com/p4square/grow/provider/Provider.java new file mode 100644 index 0000000..ca6af25 --- /dev/null +++ b/src/com/p4square/grow/provider/Provider.java @@ -0,0 +1,31 @@ +/* + * Copyright 2013 Jesse Morgan + */ + +package com.p4square.grow.provider; + +import java.io.IOException; + +/** + * Provider provides a simple interface for loading and persisting + * objects. + * + * @author Jesse Morgan <jesse@jesterpm.net> + */ +public interface Provider<K, V> { + /** + * Retrieve the object with the given key. + * + * @param key The key for the object. + * @return The object or null if not found. + */ + V get(K key) throws IOException; + + /** + * Persist the object with the given key. + * + * @param key The key for the object. + * @param obj The object to persist. + */ + void put(K key, V obj) throws IOException; +} |