Class Json.DefaultFactory
java.lang.Object
org.infinispan.commons.dataconversion.internal.Json.DefaultFactory
- All Implemented Interfaces:
Json.Factory
- Enclosing class:
- Json
-
Constructor Summary
-
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.Factory
Construct and return an object representing JSONnull
. Implementations are free to cache a return the same instance. The resulting value must returntrue
fromisNull()
andnull
fromgetValue()
.- Specified by:
nil
in interfaceJson.Factory
- Returns:
- The representation of a JSON
null
value.
-
bool
Description copied from interface:Json.Factory
Construct and return a JSON boolean. The resulting value must returntrue
fromisBoolean()
and the passed in parameter fromgetValue()
.- Specified by:
bool
in 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.Factory
Construct and return a JSON string. The resulting value must returntrue
fromisString()
and the passed in parameter fromgetValue()
.- Specified by:
string
in 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:
raw
in interfaceJson.Factory
-
number
Description copied from interface:Json.Factory
Construct and return a JSON number. The resulting value must returntrue
fromisNumber()
and the passed in parameter fromgetValue()
.- Specified by:
number
in interfaceJson.Factory
- Parameters:
x
- The numeric value.- Returns:
- Json instance representing that value.
-
array
Description copied from interface:Json.Factory
Construct and return a JSON object. The resulting value must returntrue
fromisArray()
and an implementation ofjava.util.List
fromgetValue()
.- Specified by:
array
in interfaceJson.Factory
- Returns:
- An empty JSON array.
-
object
Description copied from interface:Json.Factory
Construct and return a JSON object. The resulting value must returntrue
fromisObject()
and an implementation ofjava.util.Map
fromgetValue()
.- Specified by:
object
in interfaceJson.Factory
- Returns:
- An empty JSON object.
-
make
Description copied from interface:Json.Factory
Construct 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 aJson
instance.- Specified by:
make
in interfaceJson.Factory
- Parameters:
anything
- An arbitray Java object from which to construct aJson
element.- Returns:
- The newly constructed
Json
instance.
-