org.schemarepo.json
Interface JsonUtil

All Known Implementing Classes:
GsonJsonUtil

public interface JsonUtil

An API to convert back and forth with JSON.


Method Summary
 Iterable<SchemaEntry> schemasFromJson(String str)
          Decode a string created by schemasToJson(Iterable)
 String schemasToJson(Iterable<SchemaEntry> allEntries)
          Encode SchemaEntry objects into a String for use by schemasFromJson(String) The format is an array of objects containing id and schema fields, for example: [{"id": "0", "schema": "schema1"}, {"id": "2", "schema": "schema2"}]
 Iterable<String> subjectNamesFromJson(String str)
          Decode a string created by subjectsToJson(Iterable)
 String subjectsToJson(Iterable<Subject> subjects)
          Encode Subjects into a String for use by subjectNamesFromJson(String) The format is an array of objects containing a name field, for example: [{"name": "subject1"}, {"name": "subject2"}]
 

Method Detail

subjectsToJson

String subjectsToJson(Iterable<Subject> subjects)
Encode Subjects into a String for use by subjectNamesFromJson(String) The format is an array of objects containing a name field, for example: [{"name": "subject1"}, {"name": "subject2"}]

Parameters:
subjects - the Subject objects to encode
Returns:
The Subject objects encoded as a String

subjectNamesFromJson

Iterable<String> subjectNamesFromJson(String str)
Decode a string created by subjectsToJson(Iterable)

Parameters:
str - The String to decode
Returns:
an Iterable of Subject

schemasToJson

String schemasToJson(Iterable<SchemaEntry> allEntries)
Encode SchemaEntry objects into a String for use by schemasFromJson(String) The format is an array of objects containing id and schema fields, for example: [{"id": "0", "schema": "schema1"}, {"id": "2", "schema": "schema2"}]

Parameters:
allEntries - the SchemaEntry objects to encode
Returns:
The SchemaEntry objects encoded as a String

schemasFromJson

Iterable<SchemaEntry> schemasFromJson(String str)
Decode a string created by schemasToJson(Iterable)

Parameters:
str - The String to decode
Returns:
An Iterable of SchemaEntry


Copyright © 2015. All rights reserved.