public static class Json.DefaultFactory extends Object implements Json.Factory
Constructor and Description |
---|
DefaultFactory() |
Modifier and Type | Method and Description |
---|---|
Json |
array()
Construct and return a JSON object.
|
Json |
bool(boolean x)
Construct and return a JSON boolean.
|
Json |
make(Object anything)
Construct and return a JSON object.
|
Json |
nil()
Construct and return an object representing JSON
null . |
Json |
number(Number x)
Construct and return a JSON number.
|
Json |
object()
Construct and return a JSON object.
|
Json |
string(String x)
Construct and return a JSON string.
|
public Json nil()
Json.Factory
null
. Implementations are
free to cache a return the same instance. The resulting value must return
true
from isNull()
and null
from
getValue()
.nil
in interface Json.Factory
null
value.public Json bool(boolean x)
Json.Factory
true
from isBoolean()
and the passed
in parameter from getValue()
.bool
in interface Json.Factory
x
- The boolean value.isBoolean() == true
. Implementations
are free to cache and return the same instance for true and false.public Json string(String x)
Json.Factory
true
from isString()
and the passed
in parameter from getValue()
.string
in interface Json.Factory
x
- The string to wrap as a JSON value.public Json number(Number x)
Json.Factory
true
from isNumber()
and the passed
in parameter from getValue()
.number
in interface Json.Factory
x
- The numeric value.public Json array()
Json.Factory
true
from isArray()
and an implementation
of java.util.List
from getValue()
.array
in interface Json.Factory
public Json object()
Json.Factory
true
from isObject()
and an implementation
of java.util.Map
from getValue()
.object
in interface Json.Factory
public Json make(Object anything)
Json.Factory
Json
instance.make
in interface Json.Factory
anything
- An arbitray Java object from which to construct a Json
element.Json
instance.Copyright © 2019 JBoss by Red Hat. All rights reserved.