org.inria.ns.reflex.xml.json
Class Factory

java.lang.Object
  extended by org.inria.ns.reflex.xml.json.Factory
All Implemented Interfaces:
JSONFactory

public class Factory
extends Object
implements JSONFactory

Build XML-aware JSON objects.

Author:
Philippe Poulard
See Also:
Handler

Constructor Summary
Factory()
           
 
Method Summary
 Object newJSONArray(JSONContext context)
          Create an XComponent as a JSON array.
 Object newJSONBoolean(JSONContext context, boolean bool)
          Return a boolean object.
 Object newJSONComment(JSONContext context, String comment)
          Return an XML comment.
 Object newJSONDocument(JSONContext context)
          Create an XComponent as a JSON document.
 Object newJSONNull(JSONContext context)
          Return null.
 Object newJSONNumber(JSONContext context, Number number)
          Return the number as-is.
 Object newJSONObject(JSONContext context)
          Create an XComponent as a JSON object.
 Object newJSONString(JSONContext context, String string)
          Return the string as-is.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Factory

public Factory()
Method Detail

newJSONDocument

public Object newJSONDocument(JSONContext context)
Create an XComponent as a JSON document.

Specified by:
newJSONDocument in interface JSONFactory
Parameters:
parser - The JSON parser.
Returns:
An XComponent.
See Also:
XComponent, JSONNames.JSON_DOCUMENT

newJSONArray

public Object newJSONArray(JSONContext context)
Create an XComponent as a JSON array.

Specified by:
newJSONArray in interface JSONFactory
Parameters:
parser - The JSON parser.
Returns:
An XComponent.
See Also:
XComponent, JSONNames.JSON_ARRAY

newJSONObject

public Object newJSONObject(JSONContext context)
Create an XComponent as a JSON object.

Specified by:
newJSONObject in interface JSONFactory
Parameters:
parser - The JSON parser.
Returns:
An XComponent.
See Also:
XComponent, JSONNames.JSON_OBJECT

newJSONNull

public Object newJSONNull(JSONContext context)
Return null.

Specified by:
newJSONNull in interface JSONFactory
Parameters:
parser - The JSON parser.
Returns:
null

newJSONNumber

public Object newJSONNumber(JSONContext context,
                            Number number)
Return the number as-is.

Specified by:
newJSONNumber in interface JSONFactory
Parameters:
parser - The JSON parser.
number - The number.
Returns:
The same number that was given.
See Also:
NumberOperator.parseNumber(String)

newJSONString

public Object newJSONString(JSONContext context,
                            String string)
Return the string as-is.

Specified by:
newJSONString in interface JSONFactory
Parameters:
parser - The JSON parser.
string - The string.
Returns:
The same string that was given.

newJSONBoolean

public Object newJSONBoolean(JSONContext context,
                             boolean bool)
Return a boolean object.

Specified by:
newJSONBoolean in interface JSONFactory
Parameters:
parser - The JSON parser.
bool - The boolean.
Returns:
The same boolean that was given, but as an object.

newJSONComment

public Object newJSONComment(JSONContext context,
                             String comment)
Return an XML comment.

Specified by:
newJSONComment in interface JSONFactory
Parameters:
parser - The JSON parser.
comment - The comment.
Returns:
An XML comment.
See Also:
Comment