Package de.xima.fc.common.json
Interface IJsonBuilder<A,O>
-
- Type Parameters:
A
- Type of a JSON array.O
- Type of a JSON object.
public interface IJsonBuilder<A,O>
Builder for creating JSON data. Allows you to use different JSON libraries.- Since:
- 8.2.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
arrayAdd(A array, Object value)
Add a value to an array.Object
arrayGet(A array, int index)
Gets the value at the specified index from the array.void
arrayRemove(A arary, int index)
Removes the value at the specified index from the array.void
arraySet(A array, int index, Object value)
Sets the value at the specified index in the array.int
arraySize(A array)
Gets the size of an array.Class<A>
arrayType()
Gets the runtime type of the arrays.A
newArray()
Creates a new array.O
newObject()
Creates a new object.Object
objectGet(O object, String key)
Gets the value of the specified key from the object.Set<String>
objectKeys(O object)
Gets the keys of an object.void
objectPut(O object, String key, Object value)
Sets the value of the specified key in the object.void
objectRemove(O object, String key)
Removes the value of the specified key from the object.Class<O>
objectType()
Gets the runtime type of the objects.
-
-
-
Method Detail
-
arrayAdd
void arrayAdd(A array, Object value)
Add a value to an array.- Parameters:
array
- Array to add the value to.value
- Value to add.
-
arrayGet
Object arrayGet(A array, int index)
Gets the value at the specified index from the array.- Parameters:
array
- Array to get the value from.index
- Index of the value to get.- Returns:
- Value at the specified index.
-
arrayRemove
void arrayRemove(A arary, int index)
Removes the value at the specified index from the array.- Parameters:
arary
- Array to remove the value from.index
- Index of the value to remove.
-
arraySet
void arraySet(A array, int index, Object value)
Sets the value at the specified index in the array.- Parameters:
array
- Array to set the value in.index
- Index of the value to set.value
- Value to set.
-
arraySize
int arraySize(A array)
Gets the size of an array.- Parameters:
array
- Array to get the size of.- Returns:
- Size of the array.
-
arrayType
Class<A> arrayType()
Gets the runtime type of the arrays.- Returns:
- Runtime type of the arrays.
-
newArray
A newArray()
Creates a new array.- Returns:
- A new array.
-
newObject
O newObject()
Creates a new object.- Returns:
- A new object.
-
objectGet
Object objectGet(O object, String key)
Gets the value of the specified key from the object.- Parameters:
object
- Object to get the value from.key
- Key of the value to get.- Returns:
- Value of the specified key.
-
objectKeys
Set<String> objectKeys(O object)
Gets the keys of an object.- Parameters:
object
- Object to get the keys from.- Returns:
- Keys of the object.
-
objectPut
void objectPut(O object, String key, Object value)
Sets the value of the specified key in the object.- Parameters:
object
- Object to set the value in.key
- Key of the value to set.value
- Value to set.
-
objectRemove
void objectRemove(O object, String key)
Removes the value of the specified key from the object.- Parameters:
object
- Object to remove the value from.key
- Key of the value to remove.
-
-