AeroGear Android Library 1.1.0

org.jboss.aerogear.android.impl.datamanager
Class MemoryStorage<T>

java.lang.Object
  extended by org.jboss.aerogear.android.impl.datamanager.MemoryStorage<T>
All Implemented Interfaces:
Store<T>

public class MemoryStorage<T>
extends Object
implements Store<T>

Memory implementation of Store Store.


Constructor Summary
MemoryStorage(IdGenerator idGenerator)
           
 
Method Summary
 StoreType getType()
          Returns the type of the underlying 'store implementation'
 T read(Serializable id)
          Reads a specific object/record from the underlying storage system.
 Collection<T> readAll()
          Reads all the data from the underlying storage system.
 List<T> readWithFilter(ReadFilter filter)
          Search for objects/records from the underlying storage system.
 void remove(Serializable id)
          Removes a specific object/record from the underlying storage system.
 void reset()
          Resets the entire storage system.
 void save(T item)
          Saves the given object in the underlying storage system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemoryStorage

public MemoryStorage(IdGenerator idGenerator)
Method Detail

getType

public StoreType getType()
Returns the type of the underlying 'store implementation'

Specified by:
getType in interface Store<T>
Returns:
StoreType

readAll

public Collection<T> readAll()
Reads all the data from the underlying storage system.

Specified by:
readAll in interface Store<T>
Returns:
List of T

read

public T read(Serializable id)
Reads a specific object/record from the underlying storage system.

Specified by:
read in interface Store<T>
Parameters:
id - id from the desired object
Returns:
T

save

public void save(T item)
Description copied from interface: Store
Saves the given object in the underlying storage system.

Specified by:
save in interface Store<T>
Parameters:
item - Object to save

reset

public void reset()
Resets the entire storage system.

Specified by:
reset in interface Store<T>

remove

public void remove(Serializable id)
Removes a specific object/record from the underlying storage system.

Specified by:
remove in interface Store<T>
Parameters:
id - Id of item to remote

readWithFilter

public List<T> readWithFilter(ReadFilter filter)
Search for objects/records from the underlying storage system.

Specified by:
readWithFilter in interface Store<T>
Parameters:
filter - a filter to use to fetch an object
Returns:
List SHOULD NOT BE NULL
Throws:
IllegalArgumentException - if filter.query has nested objects

AeroGear Android Library 1.1.0

Copyright © 2013 JBoss by Red Hat. All Rights Reserved.