info.sswap.http.representation.json
Class JsonImportFactory

java.lang.Object
  extended by info.sswap.http.representation.json.JsonImportFactory

public class JsonImportFactory
extends java.lang.Object

Builds an Imports object based on information in a JSONArray.

Author:
Blazej Bulka

Constructor Summary
JsonImportFactory()
           
 
Method Summary
static Imports buildImports(org.json.JSONArray array, Prefixes prefixes)
          Builds Imports object from a JSON Array
static Imports buildImports(java.lang.String string, Prefixes prefixes)
          Builds Imports object from a JSON Array
static Imports extractImports(org.json.JSONObject containingObject, Prefixes prefixes)
          Extracts imports information from a JSON object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonImportFactory

public JsonImportFactory()
Method Detail

extractImports

public static Imports extractImports(org.json.JSONObject containingObject,
                                     Prefixes prefixes)
                              throws org.json.JSONException
Extracts imports information from a JSON object. The imports definition should be contained as one of the keys in this object ("imports"), and the value should be a JSON array. If the object does not contain imports definition, this method will return an empty Imports

Parameters:
containingObject - the JSON object containing the imports definition
prefixes - the prefixes object for resolution of QNames
Returns:
the created Imports object
Throws:
org.json.JSONException - if the JSON has invalid structure

buildImports

public static Imports buildImports(org.json.JSONArray array,
                                   Prefixes prefixes)
                            throws org.json.JSONException
Builds Imports object from a JSON Array

Parameters:
array - the JSONArray that should only contain strings (either URIs or QNames)
prefixes - the object that contains information about prefixes
Returns:
the Imports object
Throws:
org.json.JSONException - if the contents of the array are not strings

buildImports

public static Imports buildImports(java.lang.String string,
                                   Prefixes prefixes)
                            throws org.json.JSONException
Builds Imports object from a JSON Array

Parameters:
string - either URI or QName
prefixes - the object that contains information about prefixes
Returns:
the Imports object
Throws:
org.json.JSONException - if the contents of the array are not strings


Copyright (c) 2010, iPlant Collaborative, University of Arizona, Cold Spring Harbor Laboratories, University of Texas at Austin.