Class 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.
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AccountCollectionSerde

        public AccountCollectionSerde()
    • 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 - the Accounts 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 - the JSONObject to deserialize.
        Returns:
        a Collection of Accounts.
      • accountToJsonNoContainers

        public static org.json.JSONObject accountToJsonNoContainers​(Account account)
        Serialize an account to a json object, stripping out its containers.
        Parameters:
        account - the Accounts 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 - the Containers 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 - the JSONObject to deserialize.
        accountId - the parent account id of the containers.
        Returns:
        a Collection of Containers.