Package net.bitnine.agensgraph.util
Class Jsonb
java.lang.Object
org.postgresql.util.PGobject
net.bitnine.agensgraph.util.Jsonb
- All Implemented Interfaces:
Serializable,Cloneable,JsonbObject
public class Jsonb
extends org.postgresql.util.PGobject
implements JsonbObject, Serializable, Cloneable
This class is for a Jsonb value which is returned from server or will be sent to the server.
- See Also:
-
Field Summary
Fields inherited from class org.postgresql.util.PGobject
type, value -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(String key) Returns true if the given key is contained.getArray()Returns a Jsonb that wraps the array value if the Json value is array or throws UnsupportedOperationException.getArray(int index) Returns a Jsonb that wraps the array value if the value at index of the array is array or throws UnsupportedOperationException.Returns the value stored at the key.booleanReturns the boolean value if the Json value is boolean.booleangetBoolean(int index) Returns the boolean value if the value at index of the array is boolean or throws UnsupportedOperationException.booleangetBoolean(String key) Returns the value stored at the key.booleangetBoolean(String key, boolean defaultValue) Returns the value stored at the key.doubleReturns the double value if the Json value is double or throws UnsupportedOperationException.doublegetDouble(int index) Returns the double value if the value at index of the array is double or throws UnsupportedOperationException.doubleReturns the value stored at the key.doubleReturns the value stored at the key.intgetInt()Returns the integer value if the Json value is integer or throws UnsupportedOperationException.intgetInt(int index) Returns the integer value if the value at index of the array is integer or throws UnsupportedOperationException.intReturns the value stored at the key.intReturns the value stored at the key.Returns the internal structure (from json-simple 1.1.1) of the Json value.getKeys()Returns a set of keys.longgetLong()Returns the long value if the Json value is long or throws UnsupportedOperationException.longgetLong(int index) Returns the long value if the value at index of the array is long or throws UnsupportedOperationException.longReturns the value stored at the key.longReturns the value stored at the key.Returns a Jsonb that wraps the object value if the Json value is object or throws UnsupportedOperationException.getObject(int index) Returns a Jsonb that wraps the object value if the value at index of the array is object or throws UnsupportedOperationException.Returns the value stored at the key.Returns the string value if the Json value is string or throws UnsupportedOperationException.getString(int index) Returns the string value if the value at index of the array is string or throws UnsupportedOperationException.Returns the value stored at the key.Returns the value stored at the key.Returns an object that wraps automatically the value by type.getValue()Returns a string representation of the Json value.booleanisNull()Returns true if the Json value is null.booleanisNull(int index) Returns true if the value at index of the array is null or throws UnsupportedOperationException.booleanReturns true if the value stored at the key is null.voidThis method should not be used directly.intsize()Returns the size of Json value if the value is array or object.toString()Returns the string value if the Json value is string or returns null.Methods inherited from class org.postgresql.util.PGobject
clone, equals, equals, getType, hashCode, setType
-
Constructor Details
-
Jsonb
public Jsonb()This constructor should not be used directly.
-
-
Method Details
-
setValue
This method should not be used directly.- Overrides:
setValuein classorg.postgresql.util.PGobject- Throws:
SQLException
-
getValue
Returns a string representation of the Json value.- Overrides:
getValuein classorg.postgresql.util.PGobject- Returns:
- a string representation of the Json value
-
getJsonValue
Returns the internal structure (from json-simple 1.1.1) of the Json value.- Returns:
- the internal structure (from json-simple 1.1.1) of the Json value
-
tryGetString
Returns the string value if the Json value is string or returns null.- Returns:
- the string value if the Json value is string or returns null
-
getString
Returns the string value if the Json value is string or throws UnsupportedOperationException.- Returns:
- the string value if the Json value is string or throws UnsupportedOperationException
- Throws:
UnsupportedOperationException- not a string
-
getInt
public int getInt()Returns the integer value if the Json value is integer or throws UnsupportedOperationException.- Returns:
- the integer value if the Json value is integer or throws UnsupportedOperationException
- Throws:
UnsupportedOperationException- not an int
-
getLong
public long getLong()Returns the long value if the Json value is long or throws UnsupportedOperationException.- Returns:
- the long value if the Json value is long or throws UnsupportedOperationException
- Throws:
UnsupportedOperationException- not a long
-
getDouble
public double getDouble()Returns the double value if the Json value is double or throws UnsupportedOperationException.- Returns:
- the double value if the Json value is double or throws UnsupportedOperationException
- Throws:
UnsupportedOperationException- not a double
-
getBoolean
public boolean getBoolean()Returns the boolean value if the Json value is boolean.- Returns:
- the boolean value if the Json value is boolean
-
isNull
public boolean isNull()Returns true if the Json value is null.- Overrides:
isNullin classorg.postgresql.util.PGobject- Returns:
- true if the Json value is null
-
getArray
Returns a Jsonb that wraps the array value if the Json value is array or throws UnsupportedOperationException.- Returns:
- a Jsonb that wraps the array value if the Json value is array or throws UnsupportedOperationException
-
getObject
Returns a Jsonb that wraps the object value if the Json value is object or throws UnsupportedOperationException.- Returns:
- a Jsonb that wraps the object value if the Json value is object or throws UnsupportedOperationException
- Throws:
UnsupportedOperationException- not an object
-
getString
Returns the string value if the value at index of the array is string or throws UnsupportedOperationException.- Parameters:
index- the index of the array- Returns:
- the string value if the value at index of the array is string or throws UnsupportedOperationException
- Throws:
UnsupportedOperationException- not an array
-
getInt
public int getInt(int index) Returns the integer value if the value at index of the array is integer or throws UnsupportedOperationException.- Parameters:
index- the index of the array- Returns:
- the integer value if the value at index of the array is integer or throws UnsupportedOperationException
- Throws:
UnsupportedOperationException- not an array
-
getLong
public long getLong(int index) Returns the long value if the value at index of the array is long or throws UnsupportedOperationException.- Parameters:
index- the index of the array- Returns:
- the long value if the value at index of the array is long or throws UnsupportedOperationException
- Throws:
UnsupportedOperationException- not an array
-
getDouble
public double getDouble(int index) Returns the double value if the value at index of the array is double or throws UnsupportedOperationException.- Parameters:
index- the index of the array- Returns:
- the double value if the value at index of the array is double or throws UnsupportedOperationException
- Throws:
UnsupportedOperationException- not an array
-
getBoolean
public boolean getBoolean(int index) Returns the boolean value if the value at index of the array is boolean or throws UnsupportedOperationException.- Parameters:
index- the index of the array- Returns:
- the boolean value if the value at index of the array is boolean or throws UnsupportedOperationException
- Throws:
UnsupportedOperationException- not an array
-
getArray
Returns a Jsonb that wraps the array value if the value at index of the array is array or throws UnsupportedOperationException.- Parameters:
index- the index of the array- Returns:
- a Jsonb that wraps the array value if the value at index of the array is array or throws UnsupportedOperationException
- Throws:
UnsupportedOperationException- not an array
-
getObject
Returns a Jsonb that wraps the object value if the value at index of the array is object or throws UnsupportedOperationException.- Parameters:
index- the index of the array- Returns:
- a Jsonb that wraps the object value if the value at index of the array is object or throws UnsupportedOperationException
- Throws:
UnsupportedOperationException- not an array
-
isNull
public boolean isNull(int index) Returns true if the value at index of the array is null or throws UnsupportedOperationException.- Parameters:
index- the index of the array- Returns:
- true if the value at index of the array is null or throws UnsupportedOperationException
- Throws:
UnsupportedOperationException- not an array
-
getKeys
Description copied from interface:JsonbObjectReturns a set of keys.- Specified by:
getKeysin interfaceJsonbObject- Returns:
- a set of keys
-
containsKey
Description copied from interface:JsonbObjectReturns true if the given key is contained.- Specified by:
containsKeyin interfaceJsonbObject- Parameters:
key- the given key- Returns:
- true if the given key is contained
-
getString
Description copied from interface:JsonbObjectReturns the value stored at the key.- Specified by:
getStringin interfaceJsonbObject- Parameters:
key- the given key- Returns:
- the string value stored at the key
-
getString
Description copied from interface:JsonbObjectReturns the value stored at the key.- Specified by:
getStringin interfaceJsonbObject- Parameters:
key- the given keydefaultValue- returned the default value if the value stored at the key is null- Returns:
- the string value stored at the key
-
getInt
Description copied from interface:JsonbObjectReturns the value stored at the key.- Specified by:
getIntin interfaceJsonbObject- Parameters:
key- the given key- Returns:
- the int value stored at the key
-
getInt
Description copied from interface:JsonbObjectReturns the value stored at the key.- Specified by:
getIntin interfaceJsonbObject- Parameters:
key- the given keydefaultValue- returned the default value if the value stored at the key is null- Returns:
- the int value stored at the key
-
getLong
Description copied from interface:JsonbObjectReturns the value stored at the key.- Specified by:
getLongin interfaceJsonbObject- Parameters:
key- the given key- Returns:
- the long value stored at the key
-
getLong
Description copied from interface:JsonbObjectReturns the value stored at the key.- Specified by:
getLongin interfaceJsonbObject- Parameters:
key- the given keydefaultValue- returned the default value if the value stored at the key is null- Returns:
- the long value stored at the key
-
getDouble
Description copied from interface:JsonbObjectReturns the value stored at the key.- Specified by:
getDoublein interfaceJsonbObject- Parameters:
key- the given key- Returns:
- the double value stored at the key
-
getDouble
Description copied from interface:JsonbObjectReturns the value stored at the key.- Specified by:
getDoublein interfaceJsonbObject- Parameters:
key- the given keydefaultValue- returned the default value if the value stored at the key is null- Returns:
- the double value stored at the key
-
getBoolean
Description copied from interface:JsonbObjectReturns the value stored at the key.- Specified by:
getBooleanin interfaceJsonbObject- Parameters:
key- the given key- Returns:
- the boolean value stored at the key
-
getBoolean
Description copied from interface:JsonbObjectReturns the value stored at the key.- Specified by:
getBooleanin interfaceJsonbObject- Parameters:
key- the given keydefaultValue- returned the default value if the value stored at the key is null- Returns:
- the boolean value stored at the key
-
getArray
Description copied from interface:JsonbObjectReturns the value stored at the key.- Specified by:
getArrayin interfaceJsonbObject- Parameters:
key- the given key- Returns:
- the array value stored at the key
-
getObject
Description copied from interface:JsonbObjectReturns the value stored at the key.- Specified by:
getObjectin interfaceJsonbObject- Parameters:
key- the given key- Returns:
- the object value stored at the key
-
isNull
Description copied from interface:JsonbObjectReturns true if the value stored at the key is null.- Specified by:
isNullin interfaceJsonbObject- Parameters:
key- the given key- Returns:
- true if the value stored at the key is null
-
size
public int size()Returns the size of Json value if the value is array or object.- Returns:
- the size of Json value if the value is array or object
-
getTypedValue
Returns an object that wraps automatically the value by type.- Returns:
- an object that wraps automatically the value by type
-
toString
- Overrides:
toStringin classorg.postgresql.util.PGobject
-