Package lumis.doui.source
Class AbstractSourceData
- java.lang.Object
-
- lumis.doui.source.AbstractSourceData
-
- All Implemented Interfaces:
java.util.Map<java.lang.String,java.lang.Object>
,ISourceData
- Direct Known Subclasses:
SourceData
@StableMinor(version="17.0", sinceVersion="4.0") public abstract class AbstractSourceData extends java.lang.Object implements ISourceData
Abstract implementation of aISourceData
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
- Version:
- $Revision$ $Date$
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSourceData()
Creates a source data without source associated.protected
AbstractSourceData(Source source)
Creates a source data associated with the given source.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <T> T
convertValue(java.lang.String key, java.lang.Class<T> expectedClass, java.lang.Object value)
Converts a value that is associated with a given key.<T> T
get(java.lang.Object key, java.lang.Class<T> expectedClass)
Returns a data value, converted to the expected class.protected java.lang.Class<?>
getValueClass(java.lang.String key)
Returns the class the value of the given key is to be kept as.void
putAll(java.util.Map<? extends java.lang.String,? extends java.lang.Object> t)
-
-
-
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(java.lang.String key, java.lang.Class<T> expectedClass, java.lang.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 java.lang.Class<?> getValueClass(java.lang.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(java.lang.Object key, java.lang.Class<T> expectedClass)
Description copied from interface:ISourceData
Returns a data value, converted to the expected class.- Specified by:
get
in interfaceISourceData
- 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(java.util.Map<? extends java.lang.String,? extends java.lang.Object> t)
- Specified by:
putAll
in interfacejava.util.Map<java.lang.String,java.lang.Object>
-
-