Package de.Keyle.MyPet.api.gui
Interface JsonCodec<S extends Section>
- Type Parameters:
S- the section record this codec reads and writes
public interface JsonCodec<S extends Section>
JSON ↔ section-record bridge.
decode(java.lang.String, com.google.gson.JsonObject, de.Keyle.MyPet.api.gui.CodecContext) parses a section's JSON into the
concrete record; encode(S) is provided for the future web editor (round-trip).-
Method Summary
Modifier and TypeMethodDescriptiondecode(String id, JsonObject raw, CodecContext ctx) Parses a section's JSON into its record form.Writes a section record back out as JSON.
-
Method Details
-
decode
Parses a section's JSON into its record form.- Parameters:
id- section id from the parent map keyraw- the section JSON object (after sparse-merge with the bundled defaults)ctx- validation/parsing context (menu id, rows, sibling section names, etc.)- Returns:
- the decoded section record
- Throws:
ValidationException- on any structural / semantic error
-
encode
Writes a section record back out as JSON. Provided for editor round-tripping.- Parameters:
section- the section to encode- Returns:
- its JSON form, which
decode(java.lang.String, com.google.gson.JsonObject, de.Keyle.MyPet.api.gui.CodecContext)accepts again
-