Package org.apache.ofbiz.base.lang
Class JSON
- java.lang.Object
-
- org.apache.ofbiz.base.lang.JSON
-
@ThreadSafe public final class JSON extends java.lang.Object
A JSON object.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
static JSON
from(java.io.InputStream inStream)
Creates aJSON
instance from anInputStream
.static JSON
from(java.io.Reader reader)
Creates aJSON
instance from aReader
.static JSON
from(java.lang.Object object)
Creates aJSON
instance from an unknown data type.static JSON
from(java.lang.String jsonString)
Creates aJSON
instance from aString
.int
hashCode()
<T> T
toObject(java.lang.Class<T> targetClass)
Converts thisJSON
object to the specified type.java.lang.String
toString()
-
-
-
Method Detail
-
from
public static JSON from(java.io.InputStream inStream) throws java.io.IOException
Creates aJSON
instance from anInputStream
. The method assumes the character set is UTF-8.- Parameters:
inStream
-- Returns:
- a
JSON
instance - Throws:
java.io.IOException
-
from
public static JSON from(java.lang.Object object) throws java.io.IOException
Creates aJSON
instance from an unknown data type.- Parameters:
object
-- Returns:
- a
JSON
instance - Throws:
java.io.IOException
-
from
public static JSON from(java.io.Reader reader) throws java.io.IOException
Creates aJSON
instance from aReader
.- Parameters:
reader
-- Returns:
- a
JSON
instance - Throws:
java.io.IOException
-
from
public static JSON from(java.lang.String jsonString)
Creates aJSON
instance from aString
.- Parameters:
jsonString
-- Returns:
- a
JSON
instance
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toObject
public <T> T toObject(java.lang.Class<T> targetClass) throws java.io.IOException
Converts thisJSON
object to the specified type.- Parameters:
targetClass
-- Returns:
- an object of the specified type
- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-