de.hpi.fgis.dude.util.data.storage
Class InMemoryStorage<T extends Jsonable>

java.lang.Object
  extended by de.hpi.fgis.dude.util.data.storage.AbstractDuDeStorage<T>
      extended by de.hpi.fgis.dude.util.data.storage.InMemoryStorage<T>
Type Parameters:
T - The Jsonable type whose instances are stored.
All Implemented Interfaces:
DuDeStorage<T>, JsonReadable<T>, JsonWritable<T>

public class InMemoryStorage<T extends Jsonable>
extends AbstractDuDeStorage<T>

InMemoryStorage stores Jsonable instances in memory.

Author:
Matthias Pohl

Nested Class Summary
 
Nested classes/interfaces inherited from class de.hpi.fgis.dude.util.data.storage.AbstractDuDeStorage
AbstractDuDeStorage.AbstractJsonableWriter<T extends Jsonable>
 
Constructor Summary
InMemoryStorage()
          Initializes a InMemoryStorage instance.
InMemoryStorage(Collection<T> initialContent)
          Initializes a InMemoryStorage instance with the passed initial content.
 
Method Summary
 JsonableReader<T> getReader()
          Returns the JsonableReader that can be used to access the content of this DuDeStorage.
 JsonableWriter<T> getWriter()
          Returns the JsonableWriter that can be used to add instances to this DuDeStorage.
 int size()
          Returns the number of instances that are contained.
 
Methods inherited from class de.hpi.fgis.dude.util.data.storage.AbstractDuDeStorage
disableFormattedJson, enableFormattedJson, isFormattedJson
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InMemoryStorage

public InMemoryStorage()
                throws IOException
Initializes a InMemoryStorage instance.

Throws:
IOException - If an I/O error occurs while accessing the initial content.

InMemoryStorage

public InMemoryStorage(Collection<T> initialContent)
                throws IOException
Initializes a InMemoryStorage instance with the passed initial content.

Parameters:
initialContent - The content that shall be added to the storage initially.
Throws:
IOException - If an I/O error occurs while accessing the initial content.
Method Detail

getReader

public JsonableReader<T> getReader()
Description copied from interface: JsonReadable
Returns the JsonableReader that can be used to access the content of this DuDeStorage.

Returns:
The JsonableReader for iterating over the content.

getWriter

public JsonableWriter<T> getWriter()
Description copied from interface: JsonWritable
Returns the JsonableWriter that can be used to add instances to this DuDeStorage.

Returns:
The JsonableWriter for adding content to this storage.

size

public int size()
Description copied from interface: JsonReadable
Returns the number of instances that are contained.

Returns:
The size of this storage.


Copyright © 2011 Hasso Plattner Institute - Chair of Information Systems. All Rights Reserved.