added comments and new method that should be used over toString() to get the header name
@@ -9,9 +9,25 @@ import java.io.IOException;
* Created on 5/20/2017 by fr1kin
*/
public interface ISerializableJson {
- // TODO: Change it so head = JsonObject to add to
+ /**
+ * Serialize this object and all necessary data into json
+ * @param writer json writer
+ * @throws IOException if you format the json incorrectly
+ */
void serialize(final JsonWriter writer) throws IOException;
+
+ /**
+ * Deserialize data from json into a new object.
+ * @param reader json reader
+ * @throws IOException if you read the json incorrectly
+ */
void deserialize(final JsonReader reader) throws IOException;
- String toString();
+ /**
+ * A unique heading to identify this object.
+ * @return unique name
+ */
+ default String getUniqueHeader() {
+ return toString();
+ }
}
