org.cishell.framework.data
Class BasicData

java.lang.Object
  extended by org.cishell.framework.data.BasicData
All Implemented Interfaces:
Data

public class BasicData
extends Object
implements Data

A basic implementation of Data. This class was included since a simple implementation of Data will be used quite often in both application and algorithm code.

Author:
Bruce Herr (bh2@bh2.net)

Constructor Summary
BasicData(Dictionary properties, Object data, String format)
          Creates a Data object with the given data and metadata Dictionary
BasicData(Object data, String format)
          Creates a Data object with the given data and an empty metadata Dictionary
 
Method Summary
 Object getData()
          Returns the data stored in this Data object
 String getFormat()
          Returns the format of the encapsulated data.
 Dictionary getMetadata()
          Returns the metadata associated with the data stored in this Data object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicData

public BasicData(Object data,
                 String format)
Creates a Data object with the given data and an empty metadata Dictionary

Parameters:
data - The data being wrapped

BasicData

public BasicData(Dictionary properties,
                 Object data,
                 String format)
Creates a Data object with the given data and metadata Dictionary

Parameters:
properties - The metadata about the data
data - The data being wrapped
Method Detail

getData

public Object getData()
Description copied from interface: Data
Returns the data stored in this Data object

Specified by:
getData in interface Data
Returns:
The data (a Java object)
See Also:
Data.getData()

getMetadata

public Dictionary getMetadata()
Description copied from interface: Data
Returns the metadata associated with the data stored in this Data object. Standard keys and values are in the DataProperty interface.

Specified by:
getMetadata in interface Data
Returns:
The data's metadata
See Also:
Data.getMetadata()

getFormat

public String getFormat()
Description copied from interface: Data
Returns the format of the encapsulated data. If the data is a File, then this method returns what MIME type it is with "file:" prepended (eg. file:text/plain). Otherwise, the string returned should be the Java class it represents. For algorithms this format should be the same as their OUT_DATA property.

Specified by:
getFormat in interface Data
Returns:
The main format of the data
See Also:
Data.getFormat()