Class Json.DefaultFactory
java.lang.Object
org.infinispan.commons.dataconversion.internal.Json.DefaultFactory
- All Implemented Interfaces:
Json.Factory
- Enclosing class:
- Json
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionarray()Construct and return a JSON object.bool(boolean x) Construct and return a JSON boolean.Construct and return a JSON object.nil()Construct and return an object representing JSONnull.Construct and return a JSON number.object()Construct and return a JSON object.Construct and return a JSON string.
-
Constructor Details
-
DefaultFactory
public DefaultFactory()
-
-
Method Details
-
nil
Description copied from interface:Json.FactoryConstruct and return an object representing JSONnull. Implementations are free to cache a return the same instance. The resulting value must returntruefromisNull()andnullfromgetValue().- Specified by:
nilin interfaceJson.Factory- Returns:
- The representation of a JSON
nullvalue.
-
bool
Description copied from interface:Json.FactoryConstruct and return a JSON boolean. The resulting value must returntruefromisBoolean()and the passed in parameter fromgetValue().- Specified by:
boolin interfaceJson.Factory- Parameters:
x- The boolean value.- Returns:
- A JSON with
isBoolean() == true. Implementations are free to cache and return the same instance for true and false.
-
string
Description copied from interface:Json.FactoryConstruct and return a JSON string. The resulting value must returntruefromisString()and the passed in parameter fromgetValue().- Specified by:
stringin interfaceJson.Factory- Parameters:
x- The string to wrap as a JSON value.- Returns:
- A JSON element with the given string as a value.
-
raw
- Specified by:
rawin interfaceJson.Factory
-
number
Description copied from interface:Json.FactoryConstruct and return a JSON number. The resulting value must returntruefromisNumber()and the passed in parameter fromgetValue().- Specified by:
numberin interfaceJson.Factory- Parameters:
x- The numeric value.- Returns:
- Json instance representing that value.
-
array
Description copied from interface:Json.FactoryConstruct and return a JSON object. The resulting value must returntruefromisArray()and an implementation ofjava.util.ListfromgetValue().- Specified by:
arrayin interfaceJson.Factory- Returns:
- An empty JSON array.
-
object
Description copied from interface:Json.FactoryConstruct and return a JSON object. The resulting value must returntruefromisObject()and an implementation ofjava.util.MapfromgetValue().- Specified by:
objectin interfaceJson.Factory- Returns:
- An empty JSON object.
-
make
Description copied from interface:Json.FactoryConstruct and return a JSON object. The resulting value can be of any JSON type. The method is responsible for examining the type of its argument and performing an appropriate mapping to aJsoninstance.- Specified by:
makein interfaceJson.Factory- Parameters:
anything- An arbitray Java object from which to construct aJsonelement.- Returns:
- The newly constructed
Jsoninstance.
-