org.basex.query.util.json
Class JsonConverter

java.lang.Object
  extended by org.basex.query.util.json.JsonConverter
Direct Known Subclasses:
JsonMapConverter, JsonXMLConverter

public abstract class JsonConverter
extends java.lang.Object

Interface for converters from JSON to XQuery values.

Author:
BaseX Team 2005-12, BSD License, Leo Woerteler

Field Summary
static byte[] COMPACT
          The compact conversion type.
protected  InputInfo info
          Input info.
static byte[] JSONML
          The jsonml conversion type.
static byte[] MAPS
          The map conversion type.
 
Constructor Summary
JsonConverter(InputInfo ii)
          Constructor.
 
Method Summary
abstract  Item convert(java.lang.String in)
          Converts the given JSON string into an XQuery value.
static JsonConverter newInstance(byte[] type, JsonParser.Spec spec, boolean unesc, InputInfo ii)
          Returns a JsonConverter for the given configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

info

protected final InputInfo info
Input info.


MAPS

public static final byte[] MAPS
The map conversion type.


COMPACT

public static final byte[] COMPACT
The compact conversion type.


JSONML

public static final byte[] JSONML
The jsonml conversion type.

Constructor Detail

JsonConverter

public JsonConverter(InputInfo ii)
Constructor.

Parameters:
ii - input info
Method Detail

convert

public abstract Item convert(java.lang.String in)
                      throws QueryException
Converts the given JSON string into an XQuery value.

Parameters:
in - the JSON string
Returns:
the result
Throws:
QueryException - parse exception

newInstance

public static JsonConverter newInstance(byte[] type,
                                        JsonParser.Spec spec,
                                        boolean unesc,
                                        InputInfo ii)
Returns a JsonConverter for the given configuration.

Parameters:
type - conversion type
spec - JSON spec
unesc - unescape flag
ii - input info
Returns:
a JSON converter