lumis.doui.source
Class AbstractSourceData

Package class diagram package AbstractSourceData
java.lang.Object
  extended by lumis.doui.source.AbstractSourceData
All Implemented Interfaces:
Map<String,Object>, ISourceData
Direct Known Subclasses:
ParametersSourceDataWrapper, SourceData

@StableMinor(version="4.1",
             sinceVersion="4.0")
public abstract class AbstractSourceData
extends Object
implements ISourceData

Abstract implementation of a ISourceData that implements the default convertion behaviour. This convertion behaviour assumes the key is equals to the field id in the source.

This implementation does no conversion during the put method, it does conversion only during the get method. But it offers the convertValue(String, Class, Object) method to be used by it subclasses in the put implementation.

Since:
4.0.4

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
protected  Source source
          The source this source data belongs to.
 
Constructor Summary
protected AbstractSourceData()
          Creates a source data without source associated.
protected AbstractSourceData(Source source)
          Creates a source data associated with the given source.
 
Method Summary
protected
<T> T
convertValue(String key, Class<T> expectedClass, Object value)
          Converts a value that is associated with a given key.
<T> T
get(Object key, Class<T> expectedClass)
          Returns a data value, converted to the expected class.
protected  Class<?> getValueClass(String key)
          Returns the class the value of the given key is to be kept as.
 void putAll(Map<? extends String,? extends Object> t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, remove, size, values
 

Field Detail

source

protected final Source source
The source this source data belongs to.

Since:
4.0.4
Constructor Detail

AbstractSourceData

protected AbstractSourceData(Source source)
Creates a source data associated with the given source.

Parameters:
source - the source that this data will belong to.
Since:
4.0.4

AbstractSourceData

protected AbstractSourceData()
Creates a source data without source associated.

Parameters:
source - the source that this data will belong to.
Since:
4.0.4
Method Detail

convertValue

protected <T> T convertValue(String key,
                             Class<T> expectedClass,
                             Object value)
Converts a value that is associated with a given key.

Type Parameters:
T - the expected return class.
Parameters:
key - the key.
expectedClass - the expected return class.
value - the value to be converted.
Returns:
the value converted.
Since:
4.0.4

getValueClass

protected Class<?> getValueClass(String key)
Returns the class the value of the given key is to be kept as.

Parameters:
key - the key.
Returns:
the class.
Since:
4.0.4

get

public <T> T get(Object key,
                 Class<T> expectedClass)
Description copied from interface: ISourceData
Returns a data value, converted to the expected class.

Specified by:
get in interface ISourceData
Type Parameters:
T - the expected class.
Parameters:
key - the data entry key.
expectedClass - the expected class.
Returns:
the converted data value.

putAll

public void putAll(Map<? extends String,? extends Object> t)
Specified by:
putAll in interface Map<String,Object>


Lumisportal  4.1.0.071221 - Copyright © 2001-2007, Lumis. All Rights Reserved.