|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinfo.sswap.api.input.io.JSONSerializer
public class JSONSerializer
Creates a JSON representation of the given Input
object. Example output looks as follows:
{ "type": "http://www.w3.org/2002/07/owl#intersectionOf", "inputs": [ { "type": "http://www.w3.org/2002/07/owl#unionOf", "inputs": [ { "type": "http://www.w3.org/2002/07/owl#Restriction", "property": "http://sswapmeet.sswap.info/OBO/id", "min": 1, "max": 1, "range": {"type": "http://www.w3.org/2001/XMLSchema#string"} }, { "type": "http://www.w3.org/2002/07/owl#Restriction", "property": "http://sswapmeet.sswap.info/OBO/name", "min": 1, "max": 1, "range": {"type": "http://www.w3.org/2001/XMLSchema#string"} } ] }, { "type": "http://www.w3.org/2002/07/owl#Restriction", "property": "http://plantontology.sswap.info/poAnnotations/ontologies/poAnnotation/ontology", "min": 0, "max": 1, "range": { "type": "http://www.w3.org/2002/07/owl#oneOf", "values": [ { "value": "plant_structure", "datatype": "http://www.w3.org/2001/XMLSchema#string", "type": "literal" }, { "value": "plant_growth_and_development_stage", "datatype": "http://www.w3.org/2001/XMLSchema#string", "type": "literal" } ] } } ] }
Field Summary | |
---|---|
private org.json.JSONObject |
out
|
Constructor Summary | |
---|---|
JSONSerializer()
|
Method Summary | |
---|---|
private void |
addIfNotNull(org.json.JSONObject target,
java.lang.String key,
java.lang.Object value)
|
private org.json.JSONObject |
newJSONObject(Input input)
|
org.json.JSONObject |
serialize(Input input)
Serializes the given input to an object. |
private org.json.JSONObject |
serialize(InputValue inputValue)
|
void |
visit(AtomicInput input)
|
void |
visit(BNodeValue value)
|
void |
visit(EnumeratedInput input)
|
void |
visit(IntersectionInput intersection)
|
void |
visit(LiteralValue value)
|
void |
visit(PropertyInput input)
|
void |
visit(UnionInput union)
|
void |
visit(URIValue value)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private org.json.JSONObject out
Constructor Detail |
---|
public JSONSerializer()
Method Detail |
---|
public org.json.JSONObject serialize(Input input)
InputSerializer
serialize
in interface InputSerializer<org.json.JSONObject>
private org.json.JSONObject serialize(InputValue inputValue)
private org.json.JSONObject newJSONObject(Input input) throws org.json.JSONException
org.json.JSONException
private void addIfNotNull(org.json.JSONObject target, java.lang.String key, java.lang.Object value) throws org.json.JSONException
org.json.JSONException
public void visit(AtomicInput input)
visit
in interface InputVisitor
public void visit(IntersectionInput intersection)
visit
in interface InputVisitor
public void visit(UnionInput union)
visit
in interface InputVisitor
public void visit(EnumeratedInput input)
visit
in interface InputVisitor
public void visit(PropertyInput input)
visit
in interface InputVisitor
public void visit(URIValue value)
visit
in interface InputVisitor
public void visit(BNodeValue value)
visit
in interface InputVisitor
public void visit(LiteralValue value)
visit
in interface InputVisitor
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |