Package com.github.ambry.account
Class AccountCollectionSerde
- java.lang.Object
-
- com.github.ambry.account.AccountCollectionSerde
-
public class AccountCollectionSerde extends java.lang.Object
Serialize and deserialize json objects that represent a collection of accounts. Can be used to support REST APIs for account management.
-
-
Constructor Summary
Constructors Constructor Description AccountCollectionSerde()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Collection<Account>
accountsFromJson(org.json.JSONObject json)
Deserialize a json object representing a collection of accounts.static org.json.JSONObject
accountsToJson(java.util.Collection<Account> accounts)
Serialize a collection of accounts to a json object that can be used in requests/responses.static org.json.JSONObject
accountToJsonNoContainers(Account account)
Serialize an account to a json object, stripping out its containers.static java.util.Collection<Container>
containersFromJson(org.json.JSONObject json, short accountId)
Deserialize a json object representing a collection of containers.static org.json.JSONObject
containersToJson(java.util.Collection<Container> containers)
Serialize a collection of containers to a json object that can be used in requests/responses.
-
-
-
Method Detail
-
accountsToJson
public static org.json.JSONObject accountsToJson(java.util.Collection<Account> accounts)
Serialize a collection of accounts to a json object that can be used in requests/responses.- Parameters:
accounts
- theAccount
s to serialize.- Returns:
- the
JSONObject
-
accountsFromJson
public static java.util.Collection<Account> accountsFromJson(org.json.JSONObject json)
Deserialize a json object representing a collection of accounts.- Parameters:
json
- theJSONObject
to deserialize.- Returns:
- a
Collection
ofAccount
s.
-
accountToJsonNoContainers
public static org.json.JSONObject accountToJsonNoContainers(Account account)
Serialize an account to a json object, stripping out its containers.- Parameters:
account
- theAccount
s to serialize.- Returns:
- the
JSONObject
-
containersToJson
public static org.json.JSONObject containersToJson(java.util.Collection<Container> containers)
Serialize a collection of containers to a json object that can be used in requests/responses.- Parameters:
containers
- theContainer
s to serialize.- Returns:
- the
JSONObject
-
containersFromJson
public static java.util.Collection<Container> containersFromJson(org.json.JSONObject json, short accountId)
Deserialize a json object representing a collection of containers.- Parameters:
json
- theJSONObject
to deserialize.accountId
- the parent account id of the containers.- Returns:
- a
Collection
ofContainer
s.
-
-